Thanks Hyside2, Will try out and get back to you. Regards Ozuberk
This Script has Syntax error - I tried to debug but was not successful
Oh sorry forgot the before and after pictures, Here they are. [img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/1-1.jpg[/img]
For this to work please add custom format to format cells. Add 13 zeros as the custom format. See pictures....
[img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/1.jpg[/img] - [img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/2.jpg[/img] [code] Sub CountDateTime() Dim ws1 As Worksheet Set ws1 = Worksheets("Sheet1") Dim ltr...
[img alt_text='' description='']http://vbaf1.com/q/wp-content/uploads/2018/04/organizegrades.jpg[/img] Sub OrganizeGrades() Dim lastrow As Integer Dim lastcol As Integer Dim ws1 As Worksheet Dim ws2...
Dear Sir I tried the same as follows rng.Copy ws2.Cells(Rows.Count, 5).End(xlUp).Offset(1, -2).PasteSpecialxlPasteValues Run Time error is coming : Object...
Thank you for looking into this, sure i will check get back to you.
It’s like I got 4 folders (North, South,East, West) in a path and inside each region’s folder We got a folder named after our customers.
Now inside that customers folder we prepare pricing for every month in an excel file.
What I need now is a VBA Code to convert the excel files in these folders and save them to PDF in the same folder.
Kindly help me out with this.
I did not write this code but I think that it may help you. For more information about this code visit : http://www.contextures.com/excelvbapdf.html
‘for Excel 2010 and later
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
strTime = Format(Now(), “yyyymmdd\_hhmm”)
‘get active workbook folder, if saved
strPath = wbA.Path
If strPath = “” Then
strPath = Application.DefaultFilePath
strPath = strPath & “\”
‘replace spaces and periods in sheet name
strName = Replace(wsA.Name, ” “, “”)
strName = Replace(strName, “.”, “_”)
‘create default name for savng file
strFile = strName & “_” & strTime & “.pdf”
strPathFile = strPath & strFile
‘use can enter name and
‘ select folder for file
myFile = Application.GetSaveAsFilename _
FileFilter:=”PDF Files (*.pdf), *.pdf”, _
Title:=”Select Folder and FileName to save”)
‘export to PDF if a folder was selected
If myFile <> “False” Then
‘confirmation message with file info
MsgBox “PDF file has been created: ” _
& vbCrLf _
MsgBox “Could not create PDF file”
Thanks!!!! will try it out and let you know
Please try this as well.
Dim Fname As String
Fname = InputBox(“Enter file name to save”, “Save as PDF”)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Please share using the share button above.
If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.
Found the answer useful and wants to credit the user, then vote the answer (vote up).