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

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.
Try something like this...

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

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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