specific cells (fixed, thanks)

viper

Active Member
Joined
Feb 15, 2002
Messages
382
Is there any way to assign NextRow in my below code a specific cell? Right now it checks for the first blank cell in column B. Can I just assign NextRow to start at cell B9 then move down one for each invoice?
I think I tried assigning before but ran into incorrect placement of data when posting.

Code:
'Check for next empty row
    NextRow = _
    Application.WorksheetFunction.CountA(Range("b:b")) + 1
    

'Transfer Data
    Cells(NextRow, 2) = AccountName.Text
    Cells(NextRow, 3) = Invoicenumber.Text
    Cells(NextRow, 4) = Invoicedate.Value
    Cells(NextRow, 5) = Invoiceamount.Value
    Cells(NextRow, 6) = Accountnumber.Value
    
    If Check500 Then Cells(NextRow, 7) = TextBox500.Value
    If Check513 Then Cells(NextRow, :cool: = TextBox513.Value
    If Check510 Then Cells(NextRow, 9) = TextBox510.Value
    If Check610 Then Cells(NextRow, 10) = TextBox610.Value
    If Check612 Then Cells(NextRow, 11) = TextBox612.Value
    If Check613 Then Cells(NextRow, 12) = TextBox613.Value
    If Check617 Then Cells(NextRow, 13) = TextBox617.Value
    If Check624 Then Cells(NextRow, 14) = TextBox624.Value
    If Check614 Then Cells(NextRow, 15) = TextBox614.Value
    Cells(NextRow, 16) = TextBoxother.Text
    Cells(NextRow, 17) = TextBoxotherdollars.Value
    Cells(NextRow, 18) = TextBoxdiscription.Text
    Cells(NextRow, 21) = TextBoxinitials.Text
    

'Close user form
    Unload UserForm1
'Check if user has other invoices
    GetAnswer

   End If

Thanks,


_________________
I appreciate the help from everyone at Mr. Excel.

viper
This message was edited by viper on 2002-08-25 21:06
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
viper,

Test following declaration of NextRow:<pre>
NextRow = Application.WorksheetFunction.CountA(Range("B9:B65536")) + 9</pre>

HTH,
Dennis
This message was edited by XL-Dennis on 2002-08-25 15:45
 
Upvote 0
Thanks XL and Tommy,

I couldn't get either of yours to work properly, probably because of the hidden data in the cells above, the whole purpose was to dummy proof the code, if a person doesn't enter a vendor name in the Accountname text box then the code will over write each entry and then I would get calls saying the spreadsheet doesn't work. So instead I just added an "if" pop a msgbox if that textbox was left empty. I do thank you for your time.

thanks,
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top