View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
James Stephens James Stephens is offline
external usenet poster
 
Posts: 26
Default Find Cell Value and Activate

I got most of the below code from this newgroup, I have modified it slightly, my goal is to have it look up a value in column G, in this case the variable "Month4", if that value exists then assign the row number to the variable PasteRange, otherwise if the value doesn't exist, then find the last row with data, add one, and assign that row value to the variable PasteRange

Set rng = Range(Range("G2"), Range("G65000").End(xlUp)
For Each c In rn
If c = Month4 The
PasteRange = ActiveCell.Ro
Exit Fo
Els
End I
Next
If PasteRange = 0 The
PasteRange = Cells(Rows.Count, "A").End(xlUp).Row +

Els
End I

When I run it, it finds the value if it exists but then just assigns the first row to the variable PasteRange. I am not sure how to make this code select the row that it found the value in, and then assign that row to the variable PasteRange

Any help on this would be greatly appreciated

Jim