Next Row...

Chris6911

New Member
Joined
Feb 18, 2018
Messages
3
Hi Guys!

I'm currently working on a little project. It's a VBA UserForm.

The user enter his name, choose between 2 option (for Age +18 or -18) and it send information

NAME

Code:
Private Sub NAMEValue()
    Sheets("TRACKER").Range("A1") = NAME.Value
End Sub

For the age (OptionButton)

Code:
Private Sub AGEValue()
 If OB1.Value = True Then
    Sheets("TRACKER").Range("B1").Value = "1"
    Sheets("TRACKER").Range("C1").Value = "0"
ElseIf OB2.Value = True Then    
    Sheets("TRACKER").Range("B1").Value = "0"
    Sheets("TRACKER").Range("C1").Value = "1"

And a Submit button who call the NAMEValue & Age Value.

My issue is... When the next user enter his name, it print over on the A1, B1 & C1. I'd like, when he/she click on submit, that the excel go on A2-B2-C2 then A3-B3-C3 etc.

Then, I will be able to have a list of name and age.

Thank's in advance for help
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi Guys!

I'm currently working on a little project. It's a VBA UserForm.

The user enter his name, choose between 2 option (for Age +18 or -18) and it send information

NAME

Code:
Private Sub NAMEValue()
    Sheets("TRACKER").Range("A1") = NAME.Value
End Sub

For the age (OptionButton)

Code:
Private Sub AGEValue()
 If OB1.Value = True Then
    Sheets("TRACKER").Range("B1").Value = "1"
    Sheets("TRACKER").Range("C1").Value = "0"
ElseIf OB2.Value = True Then    
    Sheets("TRACKER").Range("B1").Value = "0"
    Sheets("TRACKER").Range("C1").Value = "1"

And a Submit button who call the NAMEValue & Age Value.

My issue is... When the next user enter his name, it print over on the A1, B1 & C1. I'd like, when he/she click on submit, that the excel go on A2-B2-C2 then A3-B3-C3 etc.

Then, I will be able to have a list of name and age.

Thank's in advance for help

So you need to dynamically determine the lastrow upon each submit. Can you combine your routines into one so the user only needs to press submit once? Something like:

Code:
sub processit
lastrow =Sheets("TRACKER").Columns("A").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows, LookIn:=xlValues).Row + 1
 Sheets("TRACKER").cells(lastrow,"A") = NAME.Value
 If OB1.Value = True Then
    Sheets("TRACKER").cells(lastrow,"B").Value = "1"
    Sheets("TRACKER").cells(lastrow,"C").Value = "0"
ElseIf OB2.Value = True Then    
    Sheets("TRACKER").cells(lastrow,"B").Value = "0"
    Sheets("TRACKER").cells(lastrow,"C").Value = "1"
endif
end sub
 
Upvote 0
So you need to dynamically determine the lastrow upon each submit. Can you combine your routines into one so the user only needs to press submit once? Something like:

Code:
sub processit
lastrow =Sheets("TRACKER").Columns("A").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows, LookIn:=xlValues).Row + 1
 Sheets("TRACKER").cells(lastrow,"A") = NAME.Value
 If OB1.Value = True Then
    Sheets("TRACKER").cells(lastrow,"B").Value = "1"
    Sheets("TRACKER").cells(lastrow,"C").Value = "0"
ElseIf OB2.Value = True Then    
    Sheets("TRACKER").cells(lastrow,"B").Value = "0"
    Sheets("TRACKER").cells(lastrow,"C").Value = "1"
endif
end sub

I tried and it's not working ; ROW dosen't change From A to B (etc.)
 
Upvote 0
try changing this line

lastrow =Sheets("TRACKER").Columns("A").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows, LookIn:=xlValues).Row + 1

to lastrow = Sheets("Tracker").cells(rows.count,1).end(xlup).row + 1
 
Upvote 0
Didn't work neither ; BUT I found the solution.

For some reason, it was not changing row ; so was printing on same row SUBMIT after SUBMIT

So I modified a lil bit your idea... I canged

Code:
Sheets("TRACKER").cells(lastrow,"B").Value = "1"

Into:

Code:
Sheets("TRACKER").Range("B" & ActiveCell.Row).Value = "1"

And then I created a "jumpnext()" script to change ROW. The jumpnext() change to row 2 and the new code w/ ActiveCell is copying the info at the right place

Code:
Sub jumpnext()
    Range("B" & ActiveCell.Row + 1).Select
End Sub

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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