How to save the data in seq in the target sheet using Macros in Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • metalik123
    New Member
    • Aug 2010
    • 4

    How to save the data in seq in the target sheet using Macros in Excel

    Assume it i have a data sheet of the 15 column & i have created a command button.
    The command button needs to be configured in such a way that,
    1. whenever i update the 15 columns & i click the same, the same needs to be saved in one of the targeted sheet.
    2. Then i clear the data sheet & re-enter the some other data, then i click the command button, the system should paste the data continuing to the previous saved data (step 1).

    Plse advise whether it is possible to configure the data in such a way in the Macros
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    This will copy the data from sheet(1) and append it on sheet(2)=

    Code:
    Sub CommandButton1_Click()
    Dim ARRAYDATA() As Variant
    '§ read data in array
       ARRAYDATA = Range("A1").Resize(Range("A1").End(xlDown).Row, Range("A1").End(xlToRight).Column)
    '§ copy Array to range
       With Sheets(2)
          If .Range("A1") = "" Then ' is it the first data
             .Range("A1").Resize(UBound(ARRAYDATA), UBound(ARRAYDATA, 2)) = ARRAYDATA
          Else
             .Range("A" & .Range("A1").End(xlDown).Row + 1).Resize(UBound(ARRAYDATA), UBound(ARRAYDATA, 2)) = ARRAYDATA
          End If
       End With
    End Sub

    Comment

    • metalik123
      New Member
      • Aug 2010
      • 4

      #3
      Hi,

      Thanks for the details which you had provided, but i tried the same which seems it doesnt work.

      Let me again try to example you my requirement thru an example. Plse refer to the below attachment.

      Step 1:-
      In Sheet1, is used to feed the data & print the Invoice. On Sheet2 is where the data needs to be saved.
      'Save & Print' command button is been shown in the Sheet1.

      Step 2:-
      When i updated the data in Sheet1 & click 'Save & Print' command button, system should save the data in sheet2 under the respective heading as the data in Sheet1.

      Step 3:-
      After i done the above steps, i will clear all the data in sheet1, but data copied in sheet2 should remain.

      Then again i will feed the data in Sheet1 & then click 'Save & Print' command button, then data updated in Sheet1 should be pasted from the next row after the first data is been saved as per Step 1

      Plse advise whether the above is possible thru Macro.

      Thanks for your Help in advance

      Comment

      • Guido Geurs
        Recognized Expert Contributor
        • Oct 2009
        • 767

        #4
        Is it possible to attach Your XLS in BYTES?
        Also, if possible, attach an example of how the end result must be after clicking the command button.
        From I understand for now, the data is not in rows and columns in Sheet(1) but somewhere on sheet(1).
        If I have an example, I can write the macro to do just the things You want.
        Because now I guessing what the code must be.

        Comment

        • metalik123
          New Member
          • Aug 2010
          • 4

          #5
          HI,

          I tried to upload the attachment, but the system does not allow to upload the same, as it shows some error.

          Is it possible to provide us your email address, so that i can forward the same to that, for your further analysis.

          Thanks & Have a Nice Weekend.

          Best Regards,
          Harry

          Comment

          • metalik123
            New Member
            • Aug 2010
            • 4

            #6
            Plse find the attachment

            Hi,

            Hi tried to reformat some changes in the attachment & i had uploaded the same in the Bytes. so, the system allowed to upload now.

            Plse find the attachment. It contains two sheet.
            Sheet 1:- It contains the forms wherein the details are going to be feeded
            Sheet 2:- is the target sheet where the data needs to be saved.

            When we update the details in Sheet1 as per the below sample & click the command button 'Save & Print', system should copy all the Blue Highlighted details in Sheet1 to Sheet2 as per the format.

            Again the details will be cleared the details in Sheet1, then the user re-feed the details again & click the 'Save & print' button, then the re-updated details needs to be saved in the Sheet2 from the next column after the previously saved details.

            Kindly check & advise whether the above would be configured in the system.

            Thanks,

            Best Regards,
            Harry
            Attached Files

            Comment

            • Guido Geurs
              Recognized Expert Contributor
              • Oct 2009
              • 767

              #7
              solution: see attachment.
              Attached Files

              Comment

              Working...