Consulting

Results 1 to 1 of 1

Thread: How to transfer userform data to two diffirent sheets in diffirent cells?

  1. #1

    How to transfer userform data to two diffirent sheets in diffirent cells?

    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
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •