I am trying to find the next empty cell in a range, starting from a specific column and then trying to put in todays date.
Code:
ThisWorkbook.ActiveSheet.Cells(ThisWorkbook.ActiveSheet.Rows.Count, "U").End(xlLeft).Offset(0, 1).Value = Now()
My Range to check for blank cells is V to X.
So for instance if i had a spreadsheet that looked like below:
Column U Column V Column W Column X
Start checking blanks from here but don't check this column itself I'm Not a blank Cell so move to the next cell and check I'm a blank cell. Put value here I am a blank cell. I will have a value placed in me next time
At the moment my code is putting the date in the first blank cell in a row starting from column A. This is obviously not correct.
Please can someone show me where I am going wrong?
Change xlleft to xlToLeft
I recommend to used usedrange rows count than simple sheet.rows.count for your requirement.
ThisWorkbook.ActiveSheet.Cells(ActiveSheet.UsedRange.Rows.Count,"U").End(xlToLeft).Offset(0, 1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.