Help with code to copy from one worksheet to the first blank cell in column of another

Dmetcalf2021

New Member
Joined
Jan 26, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
I am trying to create code that will copy data from selected cells on (Enter Data) worksheet and place in the first blank corresponding cell of (Inv History) worksheet


Copy from (Enter Data) "G5" paste to first blank cell in column A of (Inv History)
Copy from (Enter Data) "G8" paste to first blank cell in column B of (Inv History) - This one has a formula so has to be posted as special number or it will disappear when I clear contents of entry screen
Copy from (Enter Data) "G3" paste to first blank cell in column C of (Inv History)
Copy from (Enter Data) "G1" paste to first blank cell in column D of (Inv History)
Copy from (Enter Data) "G6" paste to first blank cell in column E of (Inv History)

I'm sure this is simple for someone but I have tried to make this work for 2 days and I just don't know enough VBA. Can someone please help me? I have other macros that are working for my process but I can't seem to figure this one out!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,434
VBA Code:
    Dim NextRow As Long
    
    With Sheets("Inv History")
        NextRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
        .Range("A" & NextRow).Value = Sheets("Enter Data").Range("G5").Value
        .Range("B" & NextRow).Value = Sheets("Enter Data").Range("G8").Value
        .Range("C" & NextRow).Value = Sheets("Enter Data").Range("G3").Value
        .Range("D" & NextRow).Value = Sheets("Enter Data").Range("G1").Value
        .Range("E" & NextRow).Value = Sheets("Enter Data").Range("G6").Value
    End With
 

Dmetcalf2021

New Member
Joined
Jan 26, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
    Dim NextRow As Long
   
    With Sheets("Inv History")
        NextRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
        .Range("A" & NextRow).Value = Sheets("Enter Data").Range("G5").Value
        .Range("B" & NextRow).Value = Sheets("Enter Data").Range("G8").Value
        .Range("C" & NextRow).Value = Sheets("Enter Data").Range("G3").Value
        .Range("D" & NextRow).Value = Sheets("Enter Data").Range("G1").Value
        .Range("E" & NextRow).Value = Sheets("Enter Data").Range("G6").Value
    End With
Worked perfect! See how simple this looks but I had a mess. Thank you!
 

Forum statistics

Threads
1,141,132
Messages
5,704,458
Members
421,351
Latest member
Sheogorath

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