Add New Customer

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Add New Customer

Post by adam »

I'm having the following lines under the command button "OK" in my same userform.

Code: Select all

'find  first empty row in database
iRow = WS.Cells(Rows.Count, 1) _
  .End(xlUp).Offset(1, 0).Row
How could I change the lines so that when I press the "OK" button from the userform the code finds first empty row after the row 10 and copies the data to that row?
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78568
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add New Customer

Post by HansV »

adam wrote:...and copies the data ...
Which data?
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Add New Customer

Post by adam »

the data from the text boxes in the userform
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78568
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add New Customer

Post by HansV »

See the code in the first post in this thread, it's already there.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Add New Customer

Post by adam »

Yes Hans. I'm aware of that.The code looks for first empty column & first empty row.

What I'm trying to make is the code to look for column "C" instead of column "A"
Because my data starts from row 11 where I have my column headers in row 10. My data starts from C10 to K10.

Meaning I want the data to get added to row 12 and onwards with the OK button.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78568
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add New Customer

Post by HansV »

You didn't mention column C in Post=21762

Change WS.Cells(Rows.Count, 1) to WS.Cells(Rows.Count, 3)

A=1, B=2, C=3 etc.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Add New Customer

Post by adam »

I was unaware of column C at the time of post 21762. but now I could get what I have mentioned in post 21762. Any way thanks for the help.
Best Regards,
Adam