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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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
 
Upvote 0
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!
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

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