PDA

View Full Version : How to transfer userform data to two diffirent sheets in diffirent cells?



Bhatti1981
10-12-2016, 11:52 AM
Greetings

In my attached file with dummy data, I have a userform that transfers data to "Journal" sheet. I want the same data to be transfered to "Vouchers" sheet in specific cells. Although I recorded a macro for "Vouchers" sheet that inserts new rows above and copies the voucher to the previous location, means userform does not need to locate the last empty row or something like that. But it is not working. Forums help is needed.
And here is the code that I am trying to work. Currently I am working on CPV Voucher Type.

Public Sub PrepareVouch()
Application.ScreenUpdating = False
Sheet2.Activate

Sheet2.Range("I2").Value = "V.NO. " & txtVNum.Value
Sheet2.Range("j6").Value = txtDate.Value
Sheet2.Range("c10").Value = Brec1.Value
Sheet2.Range("e10").Value = Drec1.Value
Sheet2.Range("j10").Value = Erec1.Value


Sheet2.Rows("1:24").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

Sheet2.Range("B25:K47").Select
Selection.Copy

Sheet2.Range("B1").Select
ActiveSheet.Paste
Sheet2.Range("I26,J30,C34:K42,E30").Select
Selection.ClearContents
Application.CutCopyMode = False
Sheet2.Range("B23").Select
Application.ScreenUpdating = True
End sub
Best Regards
Imran Bhatti