Rabu, 19 Juni 2013

RE: [ExcelVBA] Finding Multiple Occurances

 

I know this is a late response. I have been trying to find time to respond to this for a week now.
I had something similar in which I needed more than the typical message box buttons. I created a form that looked like a message box so that I could add special code. I sized my custom form down so that it looks like a regular message box.

Here is a really quick example. This should be enough to get you started.

Setup:
Create a second form and call it frmMessage
Add three command buttons and call them cmdNext, cmdPrevious, and cmdOK

In this example I added the call to the form whenever a cell data is changed. In your spreadsheet you can add it where ever it is needed. You can pass control back to the other form, and still keep the message box form visible.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
frmMessage.Show
End Sub

On the form, add this code:

Private Sub cmdNext_Click()
'Add the code to find next
Application.StatusBar = "Finding Next Record"
End Sub

Private Sub cmdOK_Click()
Application.StatusBar = "Ready"
frmMove.Hide
End Sub

Private Sub cmdPrevious_Click()
'Find Previous
Application.StatusBar = "Finding Previous Record"
End Sub

I hope this helps to get you started.

Tim

From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] On Behalf Of Payous
Sent: Thursday, June 13, 2013 12:05 AM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Finding Multiple Occurances

Hi all,
I have developed one form which is used to display all the information
that is stored in single row across different columns (single user at a
time of the row at which cursor is). I have also added search box and it
is able to find 1st occurrence of the search criteria from the
ActiveCell. However, I want to achieve the following:

* After Clicking the Search Button a message box will pop up
indicating number of occurrences of the search criteria in given range
(Assume Range to be "A5:A5000")
* Then apart from OK button on message box there should be two
additional buttons Next and Previous
* These buttons would help navigate the records found
Can anyone please help me with this
ThanksViraj

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar