Excell macro looping for numerous row

sl8a12

New Member
Joined
Jul 16, 2011
Messages
11
Basically in my workbook I have 2 sheets,
I have a table of information of different parameters and I have a calculation sheet.
If possible, I want to create a macro that will:
1. Input data from row 1 in the table into the calculation sheet
2. Save the calc sheet as a pdf with a file name corresponding to a cell in the sheet.
3. Repeat inputting data and saving the files for rows 2,3,4etc in the table.

Thank you in advance!!!


I am new to writing macros but I have managed to get this so far, this macro successfully inputs the data from row 1 of my table into my calc sheet and saves it as a pdf. I just need help with the looping, I need it to do it for row 2 then save, row 3 then save etc...
PHP:
Sub pdfsave()

    Sheets("Sheet1").Select
    ActiveCell.FormulaR1C1 = "='input table'!RC[-2]"
    Range("C4").Select
    ActiveCell.FormulaR1C1 = "='input table'!R[-1]C[-1]"
    Range("C5").Select
    ActiveCell.FormulaR1C1 = "='input table'!R[-2]C"
    Range("C6").Select
    ActiveCell.FormulaR1C1 = "='input table'!R[-3]C[1]"
    Range("C7").Select
    
pdfname = Range("A1").Value & Range("C4").Value

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=pdfname, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,224,564
Messages
6,179,544
Members
452,925
Latest member
duyvmex

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