Greetings,
i'm looking for a way to set a columns value to "US". I only want to populate the records that are on my worksheet. So, if i get a file that has 1000 rows on it, then populate every row with the "US" value in the Location column. If tomorrows file has 500 rows in it, then only the 500 rows will be populated with "US", etc... so Lastrow type of logic is needed. The column is always blank - so i am looking for my macro to update it (along with many other updates my macro is currently doing) thanks!
here is my code:
Sub TranslateLocation()
' populate LOCATION column with "US"
Cells.Find(What:="Location", After:=Range("A1"), LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireColumn.Select ' probably dont want to select entire column???
' NEED CORRECT CODE HERE...
Set myrange = Range(ActiveCell, Range("A65536").End(xlUp))
For Each Cell In myrange
Cell.Value = "US"
Next
End Sub
i'm looking for a way to set a columns value to "US". I only want to populate the records that are on my worksheet. So, if i get a file that has 1000 rows on it, then populate every row with the "US" value in the Location column. If tomorrows file has 500 rows in it, then only the 500 rows will be populated with "US", etc... so Lastrow type of logic is needed. The column is always blank - so i am looking for my macro to update it (along with many other updates my macro is currently doing) thanks!
here is my code:
Sub TranslateLocation()
' populate LOCATION column with "US"
Cells.Find(What:="Location", After:=Range("A1"), LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireColumn.Select ' probably dont want to select entire column???
' NEED CORRECT CODE HERE...
Set myrange = Range(ActiveCell, Range("A65536").End(xlUp))
For Each Cell In myrange
Cell.Value = "US"
Next
End Sub