I have a procedure where I scan a list of dates for a specific date and, once found, set the found date as the active cell. The only problem is that the specified cell is not being made active. Below is the code.
Code:
Private Sub CommandButton1_Click()
' Locate CurrentDate within StorageDates and make it the active cell
LookUpVal = Range("CurrentDate")
Worksheets("Storage").Activate
On Error Resume Next
For Each c In Worksheets("Storage").Range("StorageDates")
If c.Value = LookUpVal Then
c.Address.Select
Exit For
End If
Next
Debug.Print "c.Address = " & c.Address
Debug.Print "-------------------------"
' Copy temperatures variables & forecast MW to adjacent columns
ActiveCell.Offset(0, 1).Value = Range("MainAvgTemp")
ActiveCell.Offset(0, 2).Value = Range("MainMaxTemp")
ActiveCell.Offset(0, 3).Value = Range("MainMaxDewPt")
ActiveCell.Offset(0, 4).Value = Range("MainForecast")
End Sub
Whenever I execute this procedure, I'm left in the Storage worksheet (as I should be) but the active cell is the same like it left the sheet. The four lines outputting various cells from the Main worksheet to the Storage worksheet works just fine, putting the data in the cells to the right of that cell.
So if you guys have any ideas, please help me out.
Bookmarks