Subscript Macro: Go Cell By Cell And Format The Last Number
Apr 2, 2008
Is it possible to make a macro that will go cell by cell and format the last number of the cell as subscript? Here's an example:
Brooks #1H 5Stewart #8H, #9H 8Stevenson D Unit #1H 2150,000 BblsStewart #8H, #9H 8Stevenson D Unit #1H 2Brooks #1H 5Stewart #8H, #9H 8Holasek #1H 5Brooks #1H 5Stewart #6H, #7H 8140,000 BblsRayburn Unit #5H, #6H, #12H 6160,000 BblsHolasek #1H 5450,000 BblsStewart #6H, #7H 8#N/ARayburn Unit #5H, #6H, #12H 6Stewart #6H, #7H 8Holasek #1H 5Rayburn Unit #5H, #6H, #12H 6Stewart #6H, #7H 8Holasek #1H 5
I would like ONLY the last NUMBER of the cell to be formatted as subscript. The cells with "Bbls" would be left as is.
View 9 Replies
ADVERTISEMENT
Feb 16, 2010
I thought I had this solved but an inconsistency has shown up. I have a long list of chemical formulas that I want to format (partially) as subscript.
Basically what I need the macro to do is look at each character within a cell and check to see if it is numeric. If it is AND it follows a non-numeric character it should be formatted as subscript.
Examples
H2O the 2 should be subscript
H2SO4 the 2 and the 4 should be subscript
2CCl4 only the 4 should be subscript
View 2 Replies
View Related
Feb 16, 2010
I have a long list of chemical formulas that I want to format (partially) as subscript.
Basically what I need the macro to do is look at each character within a cell and check to see if it is numeric. If it is AND it follows a non-numeric character it should be formatted as subscript.
Examples
H2O the 2 should be subscript
H2SO4 the 2 and the 4 should be subscript
2CCl4 only the 4 should be subscript
CuSO4 - 5H2O
View 2 Replies
View Related
Oct 20, 2013
I have data in cell A1 that often changes its number format(from $ to %), can i have the number format change in cell B1 whenever the number format in cell A1 changes?
View 3 Replies
View Related
Feb 18, 2009
Been racking brain, searching through the forum here, and my Excel 2003 Bible all day trying to figure out this problem to no avail. I would like to clear the contents of any cell in a given range if the cell immediately to the right of is formatted as bold.
View 2 Replies
View Related
Dec 15, 2013
I am having slight trouble with the formatting of some cells. Every month I will be copying data into a row, the problem is Excel thinks it's a date instead of an integer of some sort.
The value copied will look something like this:
79:42:00
(meaning 79 hours and 42 minutes)
Excel is taking that and interpreting it as:
1/3/1900 7:42:00 AM
Is there an easy way to format this so Excel thinks it's a number (even if 79.7).
I tried to change the format of the cell to "Text", but it changes it to: 3.32083333333333
View 14 Replies
View Related
May 31, 2009
is it possible to custom format a cell in order to:
a) Present 3.33333 as 3.33 (max. of 2 decimal digits or less)
b) Present 3.333 as 3.33
c) Present 3.33 as 3.33
d) Present 3.3 as 3.3
e) Present 3 as 3 (NO zeros and NO decimal dot)
View 5 Replies
View Related
Jul 31, 2009
I'm working with Loan amounts and i need to know how to set a excel spread sheet to conditionally format a cell that causes a sum formula to exceed a preset limit.
Example ...
View 9 Replies
View Related
Jul 27, 2012
I believe Range.Numbeformat is the property.
I have a cell with a dropdown picker. If the user chooses "Distractor" from the picker, Worksheet_Change triggers an Inputbox to open, asking what kind of distractor it is. We'll use "Gloves" for this example.
I want the cell to display "Distractor - Gloves" while keeping the actual value as "Distractor"
The following is not working for me:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim DistractorText As String
Select Case Target.Address
Case "$B$23"
If Target.Value = "Distractor" Then
DistractorText = InputBox("Type of Distractor:")
Target.NumberFormat = "@" & " - " & DistractorText
There's more code, but I copy-pasted the trouble area. The last line using the NumberFormat property is giving me trouble.
View 3 Replies
View Related
Jul 25, 2008
Working on matching 2 column of numbers.
Unable to match as 1 column has format where number has a space in front of first character.
_425638 as opposed to
425638
Not an underscore tough
Have tried text to columns - have tried editing cell and replacing space with nothing via edit/replace but no joy only way appears to be entering cell and deleting manually - there are thousands to update.
View 9 Replies
View Related
Jun 28, 2007
i have the next formula
=IF(C6="PRODUCT 1","$"&VLOOKUP(B6,N:T,3,FALSE)&" & "&"$"&VLOOKUP(B6,N:T,5,FALSE),"N/A”)
which aberrantly returns text:
$24.675 & $26.2
I was wandering is there a way to format or put a formula which will format the numbers to be with two decimal places. The cell containing the formula is already formatted as number and the source tables are numbers with two decimal places.
i want the result to look like this
$24.68 & $26.20
View 4 Replies
View Related
Feb 19, 2008
I need to evaluate some offers and for the management I need to follow some strict rules like:
1. € 1.000.000 instead of €1000000. But that's not the problem
2. to use maximum 3 digits... Example: 10,2 or 6.12
I tried with an if function and then round, but I think that's not right way. If number < 10, then round with 2 decimal places else, round with 1 decimal place
View 3 Replies
View Related
Apr 22, 2002
Is there a way to superscript or subscript only part of a cell's text? The forum below provides VBA to superscript an entire cell.
How about just part of a cell?
e.g. Say I type "The volume of the cylinder is 42 m3", the press the arrow key once (to have the cursor before 3, hold down shift, go forward to select 3. NOW, I want to run a macro or script to superscript the selected part of the text, in this case the 3.
http://www.mrexcel.com/board/viewtop...ic=856&forum=2
How about using an inputbox to choose part of the cell?
Or using an inputbox to ask you to choose the cell,
THEN counts number of characters,
THEN asks you where to start and stop the supercript or subscript,
THEN asked if you want to superscript or subscript
THEN asks if you want to superscript/subscript (depending on what was choosen) "selectect text"(have excel store the text part selected for formatting),
THEN carries it out?
Is this possible? I don’t know enough VBA to know.
Here's some code to get people started..
Range("A1").Select
ActiveCell.FormulaR1C1 = "m3" .........
View 9 Replies
View Related
May 1, 2014
(3) examples when I type a number to a cell:
If I type a number "1", I want that cell to show 1.000% but not 100.000%.
If I type a number ".2", I want that cell to show 0.200% but not 20.000%.
If I type a number "25.5", I want that cell to show 0.255% but not 2550.000%.
I play around with the below custom format cells but they do not work.
_0.01*#.000%
_0.01*#,.000%
0.01*#,.000%
I could use two cells one for number, other cell has a % mark. But I rather to format a single cell if it is possible.
View 4 Replies
View Related
Apr 16, 2014
I have an if statement which shows either GP% or average revenue per product. The problem is that GP% needs to be in a percentage format and revenue per product needs to be in number format. 500 is now shown as 50000% or 50% will be shown as 0.5 for example. Is there anyway on changing the format of a cell based on the number?
View 1 Replies
View Related
Jan 8, 2009
just wondering if its possible to format a cell to display date and week number and if so how to go about it
eg
04/01/09 week 1
View 7 Replies
View Related
Dec 2, 2009
I enter in numbers, eg: 1, 2, 10, 24, 100, 1000 in a consecqutive cell range
They display as: 0.01, 0.02, 0.1, 0.24, 1, 10. Default cell format is general. If I change cell format to Number (with default display of 2 decimal points) it displays: 0.01, 0.02, 0.10, 0.24, 1.00, 10.00. If I also specify no decimal points, it displays: 0,0,0,0,1,10
The only way I can get the numbers I enter to display (and store) as 1,2,10,24, 100, 1000 is to change cell format to text and THEN retype th numbers into the cells. But, then it creates the green error comment in top left of each cell.
View 3 Replies
View Related
Sep 18, 2009
I have used this forum periodically and it has saved my bacon on numerous occasions so I know someone can help with this!
I created a workbook for staff planning and it's becoming a behemoth!
I'm wanting a range of cells within a row to change the number format to "[hh]:mm" based on a value in the 2nd column of that row. I have played about with a few things and can't seem to get it to work. What I have so far is this:
View 9 Replies
View Related
Nov 2, 2011
I'm trying to insert a random number into the unprotected cells on a worksheet depending on the type of number formatting in the cell. There are 4 basic cases:
Number formatted as percentNumber Formated general with no decimal placesNumber formatted general with two decimal placesNumber formatted in thousands
The code below only contains three criteria, I was trying to get that to work first....Based on this criteria I want to insert a random number of an appropriate size. Please find the vba below.
Sum randomnbr()
Dim F as String
For Each c In ActiveSheet.Range("A1:AK2500")
F = c.numberformat
If c.Locked = False And IsNumeric(c.Value) = True And c.EntireRow.Hidden = False And c.EntireColumn.Hidden = False Then
If F Like "*#,##0*" Then
c.Value = Round(Rnd, 0) * 1000000
If F Like "*%*" Then
c.Value = Round(Rnd, 2)
Else: c.Value = Round(Rnd, 2) * 1000
End If
End Sub
View 4 Replies
View Related
Oct 23, 2012
Is it possible to format a cell so that it displays 6x 0's after the number?
I.e. If cell A1 contains the number 14, id like it to display 14000000
However, that 14 million is a monetary value, so I would want it to also display $ , & .
If I change the number the following week to 21, it automatically becomes $21,000,000.00
Ive tried formatting it as a custom, but that only seems to had 6x 0's before the number
View 2 Replies
View Related
May 20, 2014
I've created a model starting from on another person's workbook, and I'm seeing an issue I haven't seen before.
For instance,
A1 = 10
A2 = 1.5
A3 = A1 * A2 = 15 (all good, so far)
If I change the number of A2 to 0 decimals places, the value shown will be 2 (which is correct, of course), but the value of A3 becomes 20. I would like for this to stay at 15 because the correct value of A2 is 1.5, not the rounded value of 2.
View 2 Replies
View Related
Sep 19, 2006
I have an excel sheet that we need to type in an account number it always starts with 8774100 then has 9 more numbers. If I leave it on number formating it always changes the last number to 0 so I format the cell as TEXT. Anyway is there a way to get the 8774100 to automatically go in and only have to type the last 9 numbers? I know I can copy paste but then I have to double click or make sure I enter the last 9 numbers at the end or use the top entry. The data entry people just want to hit enter and go from line to line fast. In the past I just divided the cell into 2 cells and made the 8774100 in column A and columb B was the ending 9 numbers. But they need to be in the same cell.
View 2 Replies
View Related
May 28, 2007
I'm writting an Excell VB application which reads data from my spreadsheet and places it into the text member of an IXMLDOMElement node in order to generate a QBXML request.
The cell I am reading from has datatype number with two decimal places as required by the xml scheme. The problem is that the Range.Value Variant data type drops the decimal point and any trailing zeros so that 1197.00 become 1197. Unfortunately, the QBXML parser requires to see the decimal as well as trailing zeros. So, 1197.90 must show up as precisely that. Changing 1197.90 into 1197.9, for example, also breaks the xml.
My Excel VBA book specifically states that a Variant data type holding numerical data will maintain the data type assigned to it.
I also tried declaring a local decimal (Dim MyDecimal As Decimal) thinking to try copying the Range.Value value to it before assigning to the QBXML field in order to force the correct data format but my VBA macro compiler does not apparently recognize "Decimal" as a valid data type event though my book clearly indicates it is one of the valid VB data types.
I am using Excel 2000. Are these problems solved in newer versions?
View 9 Replies
View Related
Oct 21, 2007
If Cell A1 in my spreadsheet is 1, then cell A2 should appear formatted as a percentage. So if a user enters 9000 into cell A2, it should appear as 9000%. If Cell A1 in my spreadsheet is 2, then cell A2 should appear as a comma-formatted whole number. So if a user enters 9000 into cell A2, it should appear as 9,000. Conditional formatting doesn't appear to let me do this.
View 5 Replies
View Related
Aug 10, 2009
My excel recently the General number format so that when the general number fomat is used and I type a number in a blank cell with the general format, the number is always divided by 10.
E.g., I enter "102", the number is automatically improperly converted to 1.02.
However, if I enter "=102", the number is properly entered as 102.
How can I reset the General format to the original setting without this divide by 100 problem?
View 3 Replies
View Related
Dec 1, 2009
Format the number in Column AL to '[hh]:mm' when Column C's value is ="P/T", otherwise format to 'General'
Column C's value is referenced from another sheet in the same workbook via a VLOOKUP function.
Column AL's value is based on an IF formula which goes like this:
=IF($C4="F/T",SUM($AJ4)+($AK4/2),SUM($D4:$AH4))
Basically the above formula asks if Column C's value is F/T then count (because if F/T then the corresponding values in that row are whole numbers). If not, then SUM (because if P/T the corresponding values in that row are set to [hh]:mm format).
I have another sheet in the same workbook which has code (quoted below) which does something similar but I don't understand it enough to get it doing what I want for the sheet in question.
View 6 Replies
View Related
May 9, 2009
I have a large spreadsheet which includes many rows whose number format needs to change depending on the value of a specific cell.
So for example:
If cell B20 has value "A", cells Q20:AG20 should display as 1,234
If cell B20 has value "B", cells Q20:AG20 should display as 5.6%
If cell B20 has value "C", cells Q20:AG20 should display as 7.89
Etc...
As conditional formatting does not seem to include a number format option I've worked out that I need some sort of macro to change these settings for me, either automatically whenever the value of B20 changes or, more likely, when I manually choose to run the macro.
View 9 Replies
View Related
Apr 20, 2006
i need to find a way to search for numbers in a cell that are attached at the end of a group of letters. ex. (xxxxxxxxx01-01-001). i want to search backwards in the cell going right to left. what i need to do is once i find the numbers i need to go to the last number ex. (......x01-.....) and in front of it place a space ex. (......x 01-.......). right now i havent come up with a formula that can do this.
View 9 Replies
View Related
Aug 24, 2007
I have uploaded a copy of the spreadsheet I am working on and have completed the user forms and coding for march the 1st only, so if you test, please use the options march and then the 1st!
The problems i have is, when I enter a number into a text box and press next page, the numbers fill where i want them to but the cells do not recognise them as numbers, therefore conditional formatting doesnt work! Even if I change the cell properties to numbers, this does not remove the error!
Second problem!! If a user forgetts to enter a value in a box, or they wish to edit just one value, and go back into the user form to change a figure, when they press next page, all the values in the column seem to disappear!
View 6 Replies
View Related
May 4, 2014
I am looking for a method to conditionally format a variable number of cells below a single cell into which data is entered.
For example ABC = 6, DEF = 12. Therefore, if I enter ABC into D1 then D1:D6 should be conditionally formatted.
View 3 Replies
View Related