I have the following script which is working fine execpt for its limited to running the loop 10 times. The macro is looking for files where the file extension could be anything between .P01 and .P99. Currently, the macro looks for file.P01 then file.P02 etc until it gets to file.P09 by increasing the value of 'i'. The trouble I am having is to get the variable 'i' to have a leading zero when the value is less than 10.
Dim OldName, NewName
Dim i As Integer
Dim strResult, strOldName, strNewName As String
Range("E14").Activate ' set first file
Application.DisplayAlerts = False
I'm using Excel 2007 and am using a look up formula =isna(match( cell, cell range, 0)) to see whether a number in one column occurs in another column.
I have been doing this process successfully for over a year on Excel 2003 and more recently on Excel 2007. This is until today, when it's stopped doing what I expect - could I have changed a setting?
The correct number format for this sheet should be 0000 (so now '67' will appear as '0067' or '290' will appear as '0290' etc.) So I have applied this Custom Format to my columns: '0000' After applying the Custom Format to the spreadsheet the numbers appear correctly - 560 now appears as 0560 - BUT in the formula bar they still only appear as the original format - so 560 is STILL 560 rather than 0560 as it should be!
As a result of this, my look up is not looking for the number in the new format, it's still looking for the number in its original format - so a look up for 0560 is actually returning results for anything with 560 in it: 560, 5600, 5601, 56000, 56007 etc. I need my look up to be looking for 0560 NOT 560.
How do I force the numbers to become 4 digits in the formula bar so that my look up for 0560 only finds a match with a cell containing 0560 and not 560, 5600, 5601, 56000, 56007 etc.
I can't format them as text because I'm getting them as an isbn with dashes (ie:978-05689-256-7) and when I remove the dashes (even if its formatted as text) excel changes the number to 9780568.9E+12 (or something like that)
I think the solution would be to create a custom format (ie. 0000000000) to preserve the zeros, but I'm having 2 problems:
1. Since the ISBN#'s have 2 different formats (ISBN-10 & ISBN-13) I need to somehow check if the first 3 numbers are 978 then based on that it should be formatted either as ISBN-10 (0000000000) or ISBN-13 (0000000000000)
2. In the post that I linked to above it said that I won't be able to do a vlookup if its custom formatted. Is there any way around this?
I have an excel spreadsheet with numbers and the format has to show zeroes at the beginning (e.g. 0011111) It is always going to be a seven digit number. I can format the cells to show the numbers with the leading zeros, but as soon as I save the file as a csv, the leading zeros are lost.
Does anyone know how to the zeros can be retained when the file is saved in csv format?
I'm trying to format an Excel 2010 spreadsheet so that I can import it into another application. I need to convert a number to text with four digits and a leading apostrophe - '0000 for example. How do I do this without having to type everything in manually?
I need Excel to create Date's of Birth from following data in column A. If the data are 7 numbers long, I need to add a '0' to the start and have used the custom format of 0#######. This works fine but I need the data in column B to just display the first 4 digits. I have used =LEFT(A1,4) to do this, but it's not picking up the 0's which I've added.
I am using the following code to import an excel file into an existing sheet. The problem I am having is the way some of the cells are being imported. Some of the cells have spaces before and after the number.
I need to delete the leading and trailing spaces for each cell affected. Is there a code I can incorporate to do this? BTW…the columns effected are columns F & G.
I have a macro that goes out to a database and pulls in updated numbers. However the numbers come in as text because they have leading 0's:
011204 011208 011209 015942 017536
The only way I can get the numbers formatted as a number and drop the leading 0 is to click on the yellow exclamation tab that pops up and click, Convert to Number. Is there any way I can write this into my macro to automatically do for me? I tried selecting the column and reformatting this way but it would not drop the leading zero:
I'm trying to convert a set of numbers between 1 and 9999 into text strings, with the number at the end as a four digit string, so 1 becomes "COLUMN0001", 123 becomes "COLUMN0123", etc. In excel, it would be easy - I would just use the text function and convert the number to a string and append it to the word COLUMN, but as far as I know, there isn't an equivalent function in excel and running excel functions in VBA is notoriously slow (especially as I will need to do this about 360,000 times).
I have been using a piece of code to save a workbook and name it as the value in a cell, for a long time the value in the cell has been alphanumeric and all has worked well. I now need to save the workbook as a 6 digit number and it has to include the leading zeros.
VB: Sub Name () Dim stBatch1 As String Range("Batch").NumberFormat = "000000" [code]....
With 000001 in the cell called Batch all that gets returned is 1, I have tried changing stBatch1 from String to Integer and that returns -1, I have also moved the NumberFormat around to various places in the code and mostly it just returns True.
I have a column of data that is given to me that is a mix of letters and numbers and I need the numbers to have leading zeros, they must all be three digits. The data has either 3, 4, or 5 letters followed by numbers 1 through 999. Example: ABCD7 I need to change it to ABCD007. I am using Excel 2004 for the Mac.
One of the reports I run provides me information on lengths of time. Such a field displays as |0:09:16| indicating 9 minutes and 16 seconds. However, when the report generates the excel spreadsheet it saves these cells in date/time format ([h]:mm:ss). If I were to convert this field to the number format (so I can manipulate and graph it) it displays as such |0.00643460648148148| Ideally I would be able to have the data in the field stored as |556| (556 seconds, or 9 minutes 16 seconds). I have thousands of fields that I need to manipulate where the data is stored in this format and I can not figure out how to fix it.
I have an Excel 2010 spreadsheet where the default number format keeps switching to the date format. I keep switching it back and it'll stay as a number format for a time, but then it'll switch back. This is also the case for any new worksheets in that one spreadsheet.
This only happens with this one file - everything else behaves according to my regional settings or to how the file had been previously formatted.
In order to export an excel table into another program I first need to save the excel file as .txt. The .txt file can then be imported by the other program.
First I however need to make excel understand that the value should be a text and not a value. I therefore format the number as text (0000150235) by adding "0000150235". After saving the file as .txt the format changes from "0000150235" to """0000150235""". I do however need the format in the .txt file to be "0000150235". Can anyone tell me how I can save "0000150235" as .txt and get the value "0000150235" in the .txt file.
I'll get straight to the point: How can I change this text format from 474556788 to 0-47455678-8 (dash added after 0 and before the last number). I need to apply this to around 5000 rows (can't do that manualy). I want it to be int his format:
474556788 to 047-455678-8
Tks Auto Merged Post;474556788 to 047-455678-8 (This is the wanted format)
I have a problem that when I try to convert text to number and format the number without 2 decimal places as seen on the link I have given below, Instead of 1607.947, I get 1607947. I have Excel 2010 loaded. The details are in below picture.
I received a request from a coworker regarding custom formatting some numbers in his spreadsheet. Those numbers are serial numbers of 20 characters long. Sometimes in my files I use this custom number formatting ###0 and its enough for the data I handle. But when I tried to use it in his spreadsheet, the following shows:
The cell must look like this: 08456891070060510302
The reason to have it like this is due to a Delivery Program requirement to deliver Set-top Units for repair. The Delivery Program do not recognize other format than the above. My coworker takes the data from a spreadsheet, and the spreadsheet needs a custom number format to display the correct number.
find a custom number format to be able to display as my coworker need it??
The included, small database is formatted as text. It is a text feed from an outside source. I simply want to format the cells into either numbers or general format but not text... seems simple, and it should be, but the only way I can get this done is to go to each cell and access the formula bar and re-enter the number by pressing Enter.
I used to get data from a database (CorVu & MIMS) in this format "0122458/001". Due to changes in those Databases I now get the data as 2 columns " 0122458" and "1" .What I need to do is somehow get this back to the old format including the leading zeros.
I have a standard block of text with numbers in it pulled from various calculations in a financial model. I have done this through a formula
e.g. ="You gross profit percentage is " & D9 & "% and your gross profit is $" & D10 & "." Problem is i'd like to format the numbers that pull through so they are easier to read. At the moment in the above example D10 results in $-600000000. I'd like it to look like $(600,000,000).
In Excel 2003, I have a series of complex(ish) lookups which populate cells in Sheet 1 from other sheets in the same workbook. Some of these cells are %ges some are not, I need to display the resultant sheet values as %ges or not based on if the cell to the left (also populated by a complex(ish) lookup) contains the character "%".
I cannot just format the cell on its own, as the list in itself is volatile and can change according to the complex(ish) lookup,
The main problem with this is I need the result to be a numeric value and NOT text in ALL cases as further calculations will be undertaken on them.
In simple if it is a %ge I need to see the %ge and use it as a %ge or if it is just a number see it as a number and use it as a number.
A B Result Req Satisfaction with telephone access (%) 0.900032390.0% Ability to see boss within 48 hours () 0.889 0.889
492 500 773 738 572 492 When I repeat this number I need that the first (492) be formatted with a color and continuous like this 200 572 format the first 572 492 format the next 492 but the actual number stays without formatting!