Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm creating a userform to be filled in and when the "OK"
control button is clicked it will fill the information in on the next available row on the spreadsheet. Following is the code I wrote but it's not working right. It's telling me I didn't call out variables. I know my brain is just not working at the moment but, Is it the "nextrow" that I need to call out? Please Help. Thanks in advance!! Here's the code I was copying out of a book: Private Sub CommandButton2_Click() 'Make sure Sheet1 is active Sheets("Sheet1").Activate 'Determine the next empty row Nextrow = Application.WorksheetFunction.CountA(Range ("A:A")) + 1 'Transfer Name Cells(Nextrow, 1) = TEXTDATE.Text Cells(Nextrow, 2) = TEXTCUSTOMER.Text Cells(Nextrow, 3) = TEXTPO.Text Cells(Nextrow, 4) = TEXTOPERATOR.Text 'Clear the controls for the next entry TEXTDATE.Text = "" TEXTCUSTOMER.Text = "" TEXTPO.Text = "" TEXTOPERATOR.Text = "" TEXTDATE.SetFocus End Sub .. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Darla
If you have some entries in, say Column A, and you have nothing below those entries all the way to the bottom of the sheet (65,536 rows), then the easiest way to find the first empty row below your last entry is: NextRow = Range("A" & Rows.Count).End(xlUp).Offset(1).Row Note that this works even if you have blank cells in Column A within your data. If you know you don't have any blank cells within your data and you have at least 2 entries, and your data starts in A1, then this will work: Range("A1").End(xlDown).Offset(1).Row HTH Otto "Darla" wrote in message ... I'm creating a userform to be filled in and when the "OK" control button is clicked it will fill the information in on the next available row on the spreadsheet. Following is the code I wrote but it's not working right. It's telling me I didn't call out variables. I know my brain is just not working at the moment but, Is it the "nextrow" that I need to call out? Please Help. Thanks in advance!! Here's the code I was copying out of a book: Private Sub CommandButton2_Click() 'Make sure Sheet1 is active Sheets("Sheet1").Activate 'Determine the next empty row Nextrow = Application.WorksheetFunction.CountA(Range ("A:A")) + 1 'Transfer Name Cells(Nextrow, 1) = TEXTDATE.Text Cells(Nextrow, 2) = TEXTCUSTOMER.Text Cells(Nextrow, 3) = TEXTPO.Text Cells(Nextrow, 4) = TEXTOPERATOR.Text 'Clear the controls for the next entry TEXTDATE.Text = "" TEXTCUSTOMER.Text = "" TEXTPO.Text = "" TEXTOPERATOR.Text = "" TEXTDATE.SetFocus End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
why a reference to an empty cell is not considered empty | Excel Discussion (Misc queries) | |||
in excel..:can't empty clip are" but already empty | Excel Discussion (Misc queries) | |||
Excel - Autom. Filter "Empty / Non Empty cells" should come first | Excel Discussion (Misc queries) | |||
How can I convert empty strings to empty cells? | Excel Discussion (Misc queries) | |||
Can blank cells created using empty Double-Quotes not be empty?? | Excel Programming |