Help with forms 2

JONNEWBY

New Member
Joined
Aug 6, 2009
Messages
15
So i Have a Form,

all the data from the form is successfully placed into the assigned work sheet.

My question is

What is the code i have to Assign so it automatically adds a row down?

right now it adds the info but every time I try and put something new it overrides what was placed before..

thanks for the help,

-JONNEWBY
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

JONNEWBY

New Member
Joined
Aug 6, 2009
Messages
15
Private Sub button_Click()


Sheets("uvpl").Range("A5").Value = Me.box1.Text
Sheets("uvpl").Range("B5").Value = Me.box2.Text
Sheets("uvpl").Range("C5").Value = Me.box3.Text
Sheets("uvpl").Range("D5").Value = Me.box4.Text
Sheets("uvpl").Range("E5").Value = Me.box5.Text
Sheets("uvpl").Range("F5").Value = Me.box6.Text
Sheets("uvpl").Range("G5").Value = Me.box7.Text
Sheets("uvpl").Range("H5").Value = Me.box8.Text

SHEET.Hide


End Sub
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Private Sub button_Click()
Dim NR As Long
With Sheets("uvpl")
    NR = .Range("A" & Rows.Count).End(xlUp).Row + 1
    .Range("A" & NR).Value = Me.box1.Text
    .Range("B" & NR).Value = Me.box2.Text
    .Range("C" & NR).Value = Me.box3.Text
    .Range("D" & NR).Value = Me.box4.Text
    .Range("E" & NR).Value = Me.box5.Text
    .Range("F" & NR).Value = Me.box6.Text
    .Range("G" & NR).Value = Me.box7.Text
    .Range("H" & NR).Value = Me.box8.Text
End With
SHEET.Hide
End Sub
 

JONNEWBY

New Member
Joined
Aug 6, 2009
Messages
15

ADVERTISEMENT

No luck it keeps on doing the same operation. Itt adds the info but after it's doesn't add a new row.

:confused:
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
I find that very strange. If you run this does it give the next blank row on the sheet?

Code:
Sub test()
Dim NR As Long
With Sheets("uvpl")
    NR = .Range("A" & Rows.Count).End(xlUp).Row + 1
End With
MsgBox NR
End Sub
 

JONNEWBY

New Member
Joined
Aug 6, 2009
Messages
15

ADVERTISEMENT

HEY VoG thanks for your help..
it is working great.......

many thanks

-JONNEWBY
 

JONNEWBY

New Member
Joined
Aug 6, 2009
Messages
15
help with form

thanks to VoG that helped me with this code........so far i have this which just to insert the data from form,

is there a method to add automatic fill color to the whole row that matches a certain criteria?


Private Sub button_Click()
Dim NR As Long
With Sheets("uvpl")
NR = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & NR).Value = Me.box1.Text
.Range("B" & NR).Value = Me.box2.Text
.Range("C" & NR).Value = Me.box3.Text
.Range("D" & NR).Value = Me.box4.Text
.Range("E" & NR).Value = Me.box5.Text
.Range("F" & NR).Value = Me.box6.Text
.Range("G" & NR).Value = Me.box7.Text
.Range("H" & NR).Value = Me.box8.Text
End With
SHEET.Hide
End Sub</pre>
 

wigi

Well-known Member
Joined
Jul 10, 2006
Messages
7,958
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Re: help with form

is there a method to add automatic fill color to the whole row that matches a certain criteria?

You can use conditional formatting if it should be automatic, that's built-in functionality in Excel.
 

wigi

Well-known Member
Joined
Jul 10, 2006
Messages
7,958
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Re: help with form

Private Sub button_Click()
Dim NR As Long
With Sheets("uvpl")
NR = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & NR).Value = Me.box1.Text
.Range("B" & NR).Value = Me.box2.Text
.Range("C" & NR).Value = Me.box3.Text
.Range("D" & NR).Value = Me.box4.Text
.Range("E" & NR).Value = Me.box5.Text
.Range("F" & NR).Value = Me.box6.Text
.Range("G" & NR).Value = Me.box7.Text
.Range("H" & NR).Value = Me.box8.Text
End With
SHEET.Hide
End Sub

Alternatively:

Code:
Private Sub button_Click()
    Sheets("uvpl").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(, 8).Value = _
        Split(box1.Text & "|" & box2.Text & "|" & box3.Text & "|" & box4.Text & "|" & _
        box5.Text & "|" & box6.Text & "|" & box7.Text & "|" & box8.Text, "|")
    Sheet.Hide
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,710
Messages
5,597,701
Members
414,164
Latest member
ARTW

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
Top