Need User form to enter the data into each column down instead of across

redstar81

New Member
Joined
Feb 13, 2018
Messages
2
So the user has a form which exports to another sheet, I need to put in columns and instead of rows


Code:
Private Sub ClearButton1_Click()

Call UserForm_Initialize


End Sub


Private Sub CloseButton2_Click()


Unload Me


End Sub


Private Sub Export_Click()


Dim emptyRow As Long


'Make Sheet3 active
Sheet3.Activate


'Determine NextRow
NextRow = WorksheetFunction.CountA(Range("A:A")) + 1


'Transfer information
Cells(NextRow, 1).Value = ListBox1.Value
Cells(NextRow, 2).Value = TextBox1.Value
Cells(NextRow, 3).Value = TextBox2.Value
Cells(NextRow, 4).Value = TextBox3.Value
Cells(NextRow, 5).Value = TextBox4.Value
Cells(NextRow, 6).Value = TextBox5.Value




End Sub


Private Sub TextBox2_Change()


End Sub


Private Sub UserForm_Initialize()


'Empty ListBox1
ListBox1.Clear


'Fill ListBox1
With ListBox1
.AddItem "Hayward Heath"
.AddItem "Birch"
.AddItem "Leonard"
.AddItem "Leeds"
.AddItem "Glasgow"
.AddItem "Priory"
.AddItem "Tithebarn"


End With


'EmptyTextBox1
TextBox1.Value = ""


'EmptyTextBox2
TextBox2.Value = ""


    With TextBox2
        .Text = "dd/mm/yyyy"
        .SetFocus
        .SelStart = 0
        .SelLength = Len(.Text)
    End With




'EmptyTextBox3
TextBox3.Value = ""


'EmptyTextBox4
TextBox4.Value = ""


'EmptyTextBox5
TextBox5.Value = ""


'Set Focus on ListBox1


End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
How about like
Code:
With Cells(NextRow, 1)
   .Value = ListBox1.Value
   .Offset(1).Value = TextBox1.Value
   .Offset(2).Value = TextBox2.Value
End With
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,533
Members
448,969
Latest member
mirek8991

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