Selecting a column and makin a loop

bountiful

New Member
Joined
Jun 18, 2015
Messages
31
Code:
Sub FindAddressColumn()
  Dim rngAddress As Range
  Set rngAddress = Range("A1:Z1").Find("Search:")
  'rngAddress(Selection.Offset(1), Selection.End(xlDown))
  'rngAddress(Seleciton.Offset(1), Selection.End(xlUp)).Select
  If rngAddress Is Nothing Then
    MsgBox "Address column was not found."
    
    
While ActiveCell Is Not Nothing     <-------my problem is here
    If ActiveCell = ActiveCell.Offset(1) Then
        'dostuff    Else
       ActiveCell = ActiveCell.Offset(1)
       
    
    
    
        
    
 
 
    
    Exit Sub
  End If
'  Range(rngAddress, rngAddress.End(xlDown)).Select
End Sub
do you see what i'm trying to do? can you help?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Perhaps something like this, but it might help to know what you want to do with the column and it's values.
Code:
Sub FindAddressColumn()
  Dim rngAddress As Range
  Set rngAddress = Range("A1:Z1").Find("Search:")

  If rngAddress Is Nothing Then
    MsgBox "Address column was not found."
  Else
     Set rngAddress = rngAddress.Offset(1)  
    
     While rngAddress<>""     <-------my problem is here
        If rngAddress = rngAddress.Offset(1) Then
        'dostuff    
        End If
       Set rngAddress = rngAddress.Offset(1)
     Wend
  End If
End Sub
 
Upvote 0
Perhaps something like this, but it might help to know what you want to do with the column and it's values.


yes, like that. You have helped so far.

basically I need to go through a column that I have dynamically found/referenced/"searched for" and do things with the data if it's the same as the last row and something else if it's different.


does that make enough sense?
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,779
Members
449,123
Latest member
StorageQueen24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top