Hi All,
I'm trying to add some code into my worksheet to simply scrolls down a list and paste the current date in the first empty cell. I keep getting the error "1004: Application or Object defined error" on the line where the cell is selected though, any ideas???
Private Sub SpecedNotify_Click() Sheets("RSPS A-Ge").Select Range("E12").Select Do Until IsEmpty(Selection) Selection.Offset(1, 0).Select Loop Selection.Offset(0, 0).Value = DateValue(Now) Sheets("Reports").Select End Sub
Get in the habit now of not selecting and activating, VBA does not have this need. Address your commands fully (sheet + cell + additional movements + command) and you it works much more efficiently:
Private Sub SpecedNotify_Click() Sheets("Sheet1").Range("E12").End(xlDown).Offset(1) = Date End Sub
Or possibly:
Private Sub SpecedNotify_Click() Sheets("Sheet1").Range("E" & Rows.Count).End(xlUp).Offset(1) = Date End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks