|
-
Apr 13th, 2005, 05:04 AM
#1
Thread Starter
New Member
Creating a Personalised Vba Form
Good afternoon,
I have only got a very little knowledge of Visual Basic and I Would like to create a full working code for one of the Excel document that I am using.
I am trying to create a personalised form in which data can be entered. I have 9 different fields and 1 of them works like an “Access” autonumber (incremented by 1).
I am using the following code to find the last data row or the first empty line:
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
I would like the column with the “autonumber data” to be already filled on the worksheet
. Is there any possibility to change the previous code in order to find the first row with no data and ignoring the first column state ( which would be already filled).
Thank you,
Last edited by L'apprentis; Apr 20th, 2005 at 03:14 AM.
-
Apr 18th, 2005, 07:16 AM
#2
Addicted Member
Re: Creating a Personalised Vba Form
Code:
ws.Cells(iRow,1).Value=iRow
or
Code:
ws.Cells(iRow,1).Value=ws.Cells(iRow-1,1).Value +1
Regards
BrianB
-------------------------------
-
Apr 25th, 2005, 09:30 AM
#3
Hyperactive Member
Re: Creating a Personalised Vba Form
Assuming that your "Autonumber" cell is in column A, you could do something like this.
VB Code:
'Selects the first empty row
Range("A2").End(xlDown).Offset(1,0).Select
'Creates the next Autonumber value in this empty row
Activecell.Value = ActiveCell.Offset(-1,0).Value + 1
Hope this helps.
Nate
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|