Nextrow in another column

G

Guest

I have an order form that has two sections for parts to be ordered

example
A: #,B:part #,C:Description,D:Qty G:#,H:part #,I: Description,J:Qty

each set of four columns has approximately 15 rows of data,i need to
determine the end of the first column set and enter data into the next.

once columns A1:A15 has it's data got to G1 and start entering data from a
user form.

I'm not sure if an array might work best for this or what ???

thank you in advance
 
B

Bob Phillips

If Range("A1").Value = "" Then
iNextRow = 1
iColumn = 1
ElseIf Range("A15").Value = "" Then
iNextRow = Cells(Rows.Count,"A").End(xlUp).Row
iColumn = 1
ElseIf Range("G1").Value = ""
iNextRow = 1
iColumn = 7
Else
iNextRow = Cells(Rows.Count,"G").End(xlUp).Row
iColumn = 7
End If

Cells(iNextRow, iColumn).Value = TextBox1.Value

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
G

Guest

Thank You for your reply bob,
this works great but I need to be able to enter data into A1,A2,A3,A4 and
so on
until A15 is filled with data then go to G1.

I tried to modify a little (and I will keep trying ) but this is only
changing the active cell A1
Thanks again for your time and effort
 
G

Guest

This is what I've come up with so far let me know if I'm going in the right
direction
hereis the code that you wrote out with my addition.
Private Sub CommandButton1_Click()
Nextrow = Application.WorksheetFunction.CountA(Range("A:A")) + 1

If Range("A1").Value = "" Then
inextrow = 1
iColumn = 1

ElseIf Range("A15").Value = "" Then
inextrow = Cells(Rows.Count, "A").End(xlUp).Row
iColumn = 1
Cells(Nextrow, 1) = TextBox1.Value

ElseIf Range("G1").Value = "" Then
inextrow = 1
iColumn = 7
Else
inextrow = Cells(Rows.Count, "G").End(xlUp).Row
iColumn = 7
End If
Cells(inextrow, iColumn).Value = TextBox1.Value




End Sub
this will go to the next cell but it alos changes the previous cell right
above it??
 
B

Bob Phillips

What I gave you was based upon entering in A1:A15 until full, then going to
G1 etc.

You must be consistent in your variable names. You are using NextRow one
minute, inextrow the next. They are not the same.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
G

Guest

Forgive me this is a new one on me I am Still trying to learn this coding
but the code you wrote only entered data into A1 nothing else unless I
manually entered data in then it would got to G1 and stay there and change
only the value in G1.
the code below is what I have now (Your code with some additions)
'
'
NextRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1

If Range("A1").Value = "" Then
inextrow = 1
iColumn = 1

ElseIf Range("A15").Value = "" Then
inextrow = Cells(Rows.Count, "A").End(xlDown).Row
iColumn = 1
Cells(NextRow, 1) = TextBox1.Value


ElseIf Range("G1").Value = "" Then
inextrow = 1
iColumn = 7
Else

inextrow = Cells(Rows.Count, "G").End(xlDown).Row
iColumn = 7
Cells(NextRow, 7) = TextBox1.Value

End If
Cells(inextrow, iColumn).Value = TextBox1.Value

Now once A1 has data it skips A2 and goes to the next A3, after that it
stays in line until A15 then goes to G1 but stays there and only changes the
value.
 
B

Bob Phillips

I repeat

You must be consistent in your variable names. You are using NextRow one
minute, inextrow the next. They are not the same.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top