copy worksheet data in userform to a worksheet

BConnery

New Member
Joined
Oct 18, 2011
Messages
5
Hi

I have embedded a worksheet called Rawdata" into a userform. Is has a number of text boxes on the userform, all the text boxes copy correctly to a worksheet called Rawdata, however i cant get the spreadsheet data to copy from the Userform to the sheet called Datapad.

The worksheet in the userform is from A1:G600, this data needs to be copied back to the Datapad worksheet B2:F601.

Many thanks

Regards Brett

code so far: issue in red bold : Cheers!!!!!!!!


Private Sub cmdadd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DataPad")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a part number

If Trim(Me.ComboBox12.Value) = "" Then
Me.ComboBox12.SetFocus
MsgBox "Please enter a pallet rack number"
Exit Sub
End If
If Trim(Me.txtstore.Value) = "" Then
Me.txtstore.SetFocus
MsgBox "Please enter a store number"
Exit Sub

End If
If Trim(Me.txtdate.Value) = "" Then
Me.txtdate.SetFocus
MsgBox "Please enter a date (dd/mm/yyyy)"
Exit Sub

End If


'copy the data to the database
ws.Cells(iRow, 1).Value = Me.ComboBox12.Value
ws.Cells(iRow, 8).Value = Me.txtdate.Value
ws.Cells(iRow, 7).Value = Me.txtstore.Value
ws.Cells(iRow, 2).Value = Me.Rawdata.Value

'clear the data
Me.txtstore.Value = ""
Me.ComboBox12.Value = ""


ActiveWorkbook.Save

End Sub


Private Sub ComboBox12_Change()
End Sub

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub CommandButton4_Click()
End Sub

Private Sub CommandButton7_Click()
UserForm1.Show

End Sub

Private Sub Label24_Click()
End Sub


Private Sub txtdate_Change()
End Sub

Private Sub txtstore_Change()
End Sub

Private Sub UserForm_Click()
End Sub

Private Sub UserForm_Activate()
txtdate.Text = Format(Now(), "DD/MM/YYYY")
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,402
Try something like this...

ws.Cells(iRow, 2).Resize(600, 7).Value = Me.Rawdata.Sheets(1).Range("A1:G600").Value
 

Watch MrExcel Video

Forum statistics

Threads
1,130,048
Messages
5,639,769
Members
417,111
Latest member
buyukbang

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