Free Microsoft Excel 2013 Quick Reference

VBA Code to Convert xls to pdf

Hi everyone,

I know that there are many programs to convet excel worksheets to pdf, but is there also a vba code that can convert an excel worksheet to PDF?


Hi there,

Can anyone tell me the VBA Code to convert an excel file into PDF format? I've tried recording this but no code was recorded. I already have Adobe Distiller 7.


Hi all,

Could someone help me to convert Excel file to Text (txt) file using VBA code.

I have data in range A3:C10 of Excel Spreadsheet and I need VBA code to read then write this data into text file and save as .txt file

Thanks in advance.


I'm looking for some code to convert numbers stored as text to numbers.

Can anyone help me with this please?


This is my first time posting and though my knowledge of excel is very good - I sue it daily my knowledg of VBA is restricted to a macro that I've borrowed from former job.
It basically puts data from a source file into a template file (both excel) and saves teh template with the specified filename. It does this for 40 different schools with different data.
I send out these reports to schools as PDF reports and I'd like the VBA code to convert the files autmatically, within the same macro that creates them. So basically after running the macro I want to end up with 40 excel files and 40 pdf files. can anyone help?


I have a sheet that details charges to clients on a month by month basis, in it there are the details of the Costs and how many the client has incurred (e.g. £5 x 25 etc.) If that cost changes then so will the total. I am looking for a VBA code that will activate when the user closes the sheet that can convert only the changed cell formula to a value. I will also do this to turn the =Username() function to a value so it is logged who charged them.

Is this possible?

Any help is greatly appreciated.


Hi All,
Can anyone help me convert the below VBA code to AppleScript? I use a Mac Powerbook that has the Microsoft Excel 2008 application installed since few days and have no access to the Excel 2004 for Mac anymore where I used this VBA code.

Sub KillDupes()
Dim rCell As Range
Dim rRange As Range
Dim lCount As Long

Set rRange = Range("A1", Range("A" & Rows.Count).End(xlUp))
lCount = rRange.Rows.Count

For lCount = lCount To 1 Step -1
With rRange.Cells(lCount, 1)
If WorksheetFunction. CountIf(rRange, .Value) > 1 Then
End If
End With
Next lCount
End Sub

Thank you in advance for your assistance.

Dear Friends,

I have PDF file name with path address mentioned in the C3:C1500 of sheet1
(Eg:- C:PDFfileOct-11.pdf). Could any one give a vba code to print all these PDF file together.

Abdul Jaleel

After importing my report to Excel my numbers are listed in text format with the green arrow in the upper corner (see attached worksheet). For my situation, the problem can easily be fixed by highlighting all of the fields and selecting "Convert to Number" from the exclamation point drop down.

Is there a way using VBA Code to replicate this process? I would like all of my values to retain their format (percentage, dollar, etc). but no longer have the green notices in the upper corner.

Any help would be greatly appreciated. Thanks!

An easy one, I hope. I've searched the help files and data base for the answer to this one, but it eludes me.

I need the VBA code to delete the following file from the hard drive, without displaying the standard Microsoft confirm delete warning:


Thanks in advance for a speedy response



i'm looking for VBA code to put in a macro to automatically save the file in a determined path with todays date as part of the filename.

For instance to save in c:reports
and make the new file name observations14052008.xls

The date format isnt that important can be other one...

can anyone help please?

Thanks a mill

How can I get VBA code to locate and open only the latest edition of an .xls or .doc file within a folder ?

We use Excel 2003

The Excel files are in one path and the Word files in another.

Almost daily there is a "latest edition" of files placed in a folder along with all of their predecessor file editions. At times there are 2 or 3 revisions within one day.

To do this manually I double-click on the "Modified" column heading to bring the latest file to the top and then I open it. Once open, I input a header, search for certain numbers or text and then print the page that meets the "find" criteria.


Can someone help me, what i need is some vba code to convert a price with a fraction in it to a decimal figure.

Eg in cell A1 you have 1.03 1/2
B1 56.05 47/64
i need to convert to 1.035


I have a user defined function called NumWord that converts a number in a cell to the words for the number.

I want to be able to run a macro that will take the value in G4, convert it to words for the number, & add enough dashes to fill the rest of cell & put it in cell H5 which is formatted to Text & 41 characters wide with left aligned. Since the font used is Ariel, there will be no fixed number of characters that will fill the cell.

My vba code so far is:
ACheckWrittenAmt = NumWord(Range("G4"))
Range("H5") = ACheckWrittenAmt

Example: I need the VBA code to put the following in cell H5 for 43.00 in G4

Fourty Three and 00/100----------------------

or put the following in cell H5 for 251.52 in G4

Two Hundred Fifty One and 52/100------------

Any VBA code suggestions will be greatly appreciated! Thanks a bunch. mikeburg

Hi all,
I am new to VBA and Excel stuff.
I am trying to convert .xls file to .html.
I am successeded in that, but when i am trying to convert another .xls
file to .csv the previously generated .csv file gets lost, i..e it is
not seen, may be it get replace with new file(though names are
Is any body getting same problem.

I want to save previous .csv file also.

Reply soon

Thank you


I have a formatted worksheet “View Format” that needs to be copied to another existing worksheet “View Request” whenever the user makes a new request. Everything on the “View Format” sheet needs to be copied to the “View Requested” sheet. This resets (refresh) the “View Requested” sheet for the next user request.

I was using VBA code to delete worksheet “View Requested”, then create to copy of Worksheet “View Format” that becomes “View Format (2)” then rename it to “View Requested”.

This accomplished the refresh, but keeps incrementing the worksheet numbers in the sheet properties for “View Requested” sheet.

I would like VBA code that will copy everything on the “View Format “ sheet to overlay everything on the “View Requested “sheet. That includes Buttons, Text, Columns, Rows, etc.

Here is the code I am using to delete and copy the existing sheets.

Sub Replace_View_Requested_Sheet()
' Replace_View_Requested_Sheet Macro
' Macro created 10/22/2010 by Jim Lombardi

    Sheets("View Requested Format").Select
    Sheets("View Requested Format").Copy Before:=Sheets(4)
    Application.DisplayAlerts = False
    Sheets("View Requested").Select
    Application.DisplayAlerts = True

    Sheets("View Requested Format (2)").Select
    Sheets("View Requested Format (2)").Name = "View Requested"
End Sub
Here is the workbook:

Jaguar XJ8 Major Repair & Safety Issues Format WIP.xls

Look at "AT a Glance" worksheet, the option button entitled "Refreash View Requested" runs the macro "Replace_View_Requested_Sheet()". Looks like I misspelled Refresh in the option button text. Oh well, I will fix that later.

Thank you in advance for your help with this coding.

Jim Lombardi

Hello all,

#1 - Is there vba code to tell if a workbook is [Signed, unverified] or is
[Signed, verified]?

I can see it in the window caption (Microsoft Excel - MyTest.xls [Signed,
unverified]), but I don't know how to capture in vba.

I am writing an addin and I would like to check this status (to make sure no
one changed the worksheet since the digial signature was added) before the
addin utilizes data on the worksheet.

I found the code to check the digital signature of the VBA project, but not
this. I see Word has SignatureSet, but I can't seen to locate anything
similar in Excel.

#2 - how does one save the workbook to make the window caption say "[Signed,
verified]"? What do I do to verify it?

Any help would be greatly appreciated. thx.


I am trying to use the VLOOKUP Function to look up values from different
workbooks. Instead of manually typing in the "table_array", I want the
"table_array" to be specified in a cell, and am trying to use an embedded
Text Function to return the "table_arrarayā€¯ from that cell.

For example, suppose cell A1 of Workbook 1 specifies the "table_array",
which is contained in Workbook 2, as: 'C:Example[Workbook

The formula that I have been using is: VLOOKUP(B5,TEXT(A1,""),3,FALSE)

However, this returns an error because the TEXT(A1,"") formula returns the
table_array as "'C:Example[Workbook 2.xls]Example'!$A$1:$G$100", instead of
the above. This generates an error, because the formula returns parentheses
at the beginning and end of the "table_array" (I can see that by clicking on
"Show Calculation Steps"). I canā€™t think of a way to remove those
parentheses. Maybe there is a way to use VBA code to create a function that
would return the contents of cell A1 without the parentheses.

If you can think of a way to accomplish this, please let me know. Any
assistance you provide would be GREATLY appreciated.


I'm still a rookie at this and can readily use any help y'all can provide. I need to have some VBa code to do the following things:

1. Conditionally format a range - cells in "a" should be filled in red with white bold text when value is >20
(value of a is detrmined by subtracting the date in column b from the System date auto entered in c1)

2. Prevent the user from inserting/deleting rows from the Insert menu and from the right click menu

3. Allow users to insert rows that will be properly formatted by using a button (ax:hX) - they should also be able to delete a row (ax:hx).

I realize that this is a rather large request but I am hopeful that there is indeed a generous individual in the group willing to lend me his/her expertise.

Thank you


Does anyone know the name of some software that will convert my VBA code to UML diagrams? If it will convert from UML to code, that is good too, but what I am looking for it code to UML.

I'm a novice at using macros in excel and I need to convert 3 columns and 255 rows of decimal numbers into hexidecimal numbers. I've done the easy part and created buttons on my excel sheet, one button to convert to hex and the other to convert back to decimal. Can anyone help me with the VBA code to get these buttons working?

I want to create a function in VBA that has a cell and a range as input like this: MyFunction (cell1, range1)
End functionCalling MyFunction with input parameters cell1 = A1 and range1 = $A$1:$A$10 MyFunction should evaluate the following formula:RANK(A1,$A$1:$A$10,0)+COUNTIF(A$1:A1,A1)-1The difficulty with this is that the input range is specified as an absolute reference ($A$1:$A$10) but the formula should use a semi-relative range in the count if statement (A$1:A1).

Can someone please show me the code to do this?

Many Thanks !

Hi All,

I have reported the above question in forum ( with the attachment.

Any help would be greatly appreciated.

Many Regards

Hi All,

Respected Members please accept my sincere thanks for all your esteemed help given through this channel.

I have attached a sample worksheet which I use in work. My aim is to find job nuumbers on sheet1 in the dataset on sheet 2(column A) and return the corresponding values iolumn B & C on sheet 2. Please note that one job number can be paid more than one time in the past months(eg. 3300023104), and therefore the requirement is to total the amount of money paid in all months, on a particular job reference. The output i require on sheet 1 is "month paid in" and "amount paid ". If a job is paid just once then simply get the month and amount on sheet 1. But i dont know if a paricular job like 3300023104 has been paid loads of times in several months, how can we list the months as well as the amount. If months is not possible then only amount can do...

My objective is to find out how much money has been paid before on the jobs mentioned on sheet 1 column A (my current month invoice). I already have a vba code to trace any duplicates within column A on sheet 1. For instance job ref 3300023104 has been repeated a few times on sheet 1.

Please advise at your convenience.

Thank you

I would like to know if there is a VBA code to help me sum up the values by date for the following fields (Begin, In, Out, Ending) based on the "Indicator" and "Type" criteria?

The details are in the attached spreadsheet. Thanks in advance for your help!


1. I require VBA code to overwrite excel file in destination folder if exist.

Actually my macro code first sort,save and close the file, then it copy and paste this excel file to destiny network drive.

All things are working here except copy and paste. I am able to copy and then move file to destiny but I want to paste it and not move.
Help in this regard really appreciated