VBA to convert pdf

Abdulkhadar

Board Regular
Joined
Nov 10, 2013
Messages
165
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hi Excel Experts.
I want to save excel sheet as pdf, file name is as per cell C15, location -desktop.
Thank you
 
Can you in a concise manner explain what you want to achieve. I am horrible at going through other's code and try to understand.
I did see that two sheets are excluded when ClearingContents but if you want all the other stuff done the "Next ws" needs to be moved after you save the sheet to PDF
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
If you take the time to answer post #11, it should be pretty simple.
 
Upvote 0
Can you in a concise manner explain what you want to achieve. I am horrible at going through other's code and try to understand.
I did see that two sheets are excluded when ClearingContents but if you want all the other stuff done the "Next ws" needs to be moved after you save the sheet to PDF

Can you in a concise manner explain what you want to achieve. I am horrible at going through other's code and try to understand.
I did see that two sheets are excluded when ClearingContents but if you want all the other stuff done the "Next ws" needs to be moved after you save the sheet to PDF
Your code is working as per my goal. generated all sheets in pdf. thank you.
In "Data" sheet column F have contains sheets names. my code work as, first clear the contents from 19 row of every sheets except "Centre" and "Data" sheets. then from "Data" sheet transfer data from column B to E to concerned sheets as per column F (sheets name).
Now I want to set up the page up to last content row of every sheets from column A to E exclude "Centre" and "Data" sheets and convert pdf exclude "Centre" and "Data" sheets.
 
Last edited:
Upvote 0
Question.
You are looping through all Sheets in the Workbook with the exception of two Sheets ("Data" & "Center") with "For Each ws In Worksheets"
Why do we need to get the Sheet Names from "Data" Sheet?
 
Upvote 0
I must be misunderstanding.
If you clear from Row 19 on down, your first empty cell will be A19, B19, C19 etc
Why do we need to find the last Row with Cells(Rows.Count, "B").End(xlUp)? The offset should be 19
If possible put your workbook with before and afters in DropBox or similar free site and let us know how to get it.
 
Upvote 0
Question.
You are looping through all Sheets in the Workbook with the exception of two Sheets ("Data" & "Center") with "For Each ws In Worksheets"
Why do we need to get the Sheet Names from "Data" Sheet?
because the data transferred to concerned sheets as per column F of "Data" sheet, the sheets names are as it is in column F of "Data" sheet. so data transferred to concerned sheets as it as in column F sheet name. In "Data" sheet, In the F column of "Data" sheet, "Centre" and "Data" name sheet are not included. If any changes in "Data" sheet, so when update the data want to clear the content of all sheets except these two sheet, then update the data as per in "Data" sheet again.
 
Upvote 0
I must be misunderstanding.
If you clear from Row 19 on down, your first empty cell will be A19, B19, C19 etc
Why do we need to find the last Row with Cells(Rows.Count, "B").End(xlUp)? The offset should be 19
If possible put your workbook with before and afters in DropBox or similar free site and let us know how to get it.
Supervisor List Mar-24.xlsm
 
Upvote 0
OK, got it. Thank you very much.
There are a lot of duplicate sheet names in Column F so I assume you want these filtered and copied into these same named sheets.
I would not think that if you have for instance 20 times a sheet in Column F that you want to copy one row and print, copy the next row and print and do this for all 20 times that you copied data across. In other words, you only want the sheets saved to a pdf file once when we've looped, or filtered, through all of Column F
Do the existing data need to be deleted first. From your code it looks like just add it to the bottom and print. Is that right.
Let us know if my thoughts are as you need it done.
It is bed time here now so it'll be tomorrow.
 
Upvote 0
OK, got it. Thank you very much.
There are a lot of duplicate sheet names in Column F so I assume you want these filtered and copied into these same named sheets.
I would not think that if you have for instance 20 times a sheet in Column F that you want to copy one row and print, copy the next row and print and do this for all 20 times that you copied data across. In other words, you only want the sheets saved to a pdf file once when we've looped, or filtered, through all of Column F
Do the existing data need to be deleted first. From your code it looks like just add it to the bottom and print. Is that right.
Let us know if my thoughts are as you need it done.
It is bed time here now so it'll be tomorrow.
(y)
 
Upvote 0

Forum statistics

Threads
1,215,165
Messages
6,123,391
Members
449,098
Latest member
ArturS75

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