I'm new to using vba and I've been trying to come up with a userform that will take information given and enter it into the next empty cell below it here is the code i've been trying to use but it is failing
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Row = 1
Range("A2").Value = Me.txtDate.Value
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
If anyone has a solution i would greatly appreciate it
I'm not sure exactly what you are trying to find after you've already put the value into A2 but this may be able to replace all of the code you supplied.
Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = Me.txtDate.Value
This is the equivalent of starting at the bottom row of column A (A1048576) and tapping Ctrl+<up arrow>
then moving down one cell.
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.