View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default UserForm assigns cell address to Variable

Maybe this:

Sub findIt()
Dim lr As Long, srchRng As Range, myCell As String
lr = ActiveSheet.Cells(Rows.Count, 4).End(xlUp).Row
Set srchRng = ActiveSheet.Range("D2:D" & lr)
myCell = srchRng.Find("AuditID=02", LookIn:=xlValues).Address
End Sub



"MikeF" wrote:

UserForm.show is frmAuditID.

Column D contains a few hundred instances of "AuditID-01" and then
"AuditID-02", sorted in ascending order [ie all instances of 01 are first].
Sometimes there are many more, ie AuditID-03 and so on, but always sorted in
ascending order.
A list of these, however many there may be, appears in frmAuditID.

The objective is to have frmAuditID appear at the start of a sub, I choose -
say "AuditID-02" - and it assigns the cell address of wherever the *first*
occurence of "AuditID-02" is in column d to a variable named "myCell".
Sometimes "AuditID-02" will be in cell d44, sometimes in cell d233,
sometimes, in d411, and so on.

Note - the "finding" part of this can be manually accomplished by selecting
cell d7, CTRL-F, search sheet/columns/values and then just punching -01 or
-02 or -03, etc ....

** Once myCell is given the appropriate address, another subroutine will
then run, using the base address of "myCell" to navigate from.

Any assistance will be *sincerely* appreciated.

Thanx in advance,
- Mike