VBA Help - Export Excel Form Data from one workbook to next empty row in another workbook with different cell organization XL 2010

Excelerometer

New Member
Joined
Aug 27, 2013
Messages
12
Here is the scenario:

Workbook "Calculator" is completed by several different users and is e-mail to one particular user via a submit button macro. The calculator includes the following info that then needs to be exported to a "MasterList" located in another workbook (info in parentheses indicates the paste location in the MasterList)

K14 - Name; (to column E)
M14 -DOB; (to column F)
D6 - Number 1 (to column B)
D8 - Number 2 (to column C)
D10 - Type (to column D)

B14 - Specific Date (to column H)
D14 - Specific Date 2 (to column M)

To complicate things a bit, there are spaces for nine (9) potential names. (K14, 16, 18, 20, 22, 24, 26, 28, 30). Each name would share the same information from the other cells listed. Although there are 9 spaces, there typically would be less entries.

ATTEMPTS I'VE MADE:

I tried to record my own macro where I copied the desired cells in the calculator and pasted them into the masterlist. This worked; however, I was having several issues.

1) The recorded macro always pastes the info in to the same row (I tried integrating a "next empty row" line to the recorded macro without any success)

2) I do not want blank info to be pasted into the masterlist (if there is no name, there should be no export). The one solution I thought of was to create an export button next to each name, instead of one "master export" button.

WHAT I NEED:

I need VBA code that enters the data mentioned into the NEXT EMPTY ROW -- IN THE COLUMNS THAT I SPECIFIED. I would like to export using one button, so that if a name does not appear, an extra line is not created, but I could manage with a button next to every name.

Any help would be greatly appreciated! Thank you in advance!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try the below and let me know if it works. Please don't use capitals in questions, it's like you're shouting & I'm hungover! haha

HTML:
Sub PasteNextLine()
    Dim LR As Long
    
    ''''enter you macro to copy info
    Sheets("Master List").Select 'your paste to sheet name
    
    'Last Row in "Master List" - change column as you need
     LR = Sheets("Master List").Range("A" & Rows.Count).End(xlUp).Row
    
    Range("A" & LR).Select 'change A as you need - it selects the last row
    
    'paste
     
End Sub
 
Upvote 0
ok, so you have your code that ocpies the data you want? So paste in at the comment that says ''code to copy

Then my code just selects the sheet where you want to paste to, just replace "Master List" with the name of your sheet.

The next line of code just finds the last row with data in column A

Then the next line selectw the last row in column A. You can column to which ever you want.

Then place you code to paste the data.

Does that make sense?

HTML:
Sub PasteNextLine()    

Dim LR As Long        

''''Code to copy    

Sheets("Master List").Select 'your paste to sheet name       
 
'Last Row in "Master List" - change column as you need     

LR = Sheets("Master List").Range("A" & Rows.Count).End(xlUp).Row        

Range("A" & LR).Select 'change A as you need - it selects the last row        

'paste     

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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