Hi !
I want vba code to turn last number in superscript format in column C and if possible a formula for if any value of column A after decimal >= 50 should turn in round up value.
Please have a look at picture attached.
Thanks & Regards
Raindrop
VBA Code To Turn Last Number Of Cell In Superscript Format
-
- Lounger
- Posts: 36
- Joined: 04 Feb 2013, 06:22
VBA Code To Turn Last Number Of Cell In Superscript Format
You do not have the required permissions to view the files attached to this post.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
Hi Raindrop,
The formula you need for the second part of your question is this:
=IF(A1-INT(A1)>=0.5,ROUNDUP(A1,0),A1)
The formula you need for the second part of your question is this:
=IF(A1-INT(A1)>=0.5,ROUNDUP(A1,0),A1)
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
The code you can use is this:
It will convert the last character in all the cells in your selection to a superscript.
Select the cells to process and run the macro/
It will convert the last character in all the cells in your selection to a superscript.
Select the cells to process and run the macro/
Code: Select all
Sub SuperscriptChar()
Dim i As Long
For i = 1 To Selection.Cells.Count
Selection.Cells(i).Characters(Start:=Selection.Cells(i).Characters.Count, _
Length:=1).Font.Superscript = True
Next i
End Sub
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Lounger
- Posts: 36
- Joined: 04 Feb 2013, 06:22
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
Thank You Rudi Sir,
You made my work easy. Could you please modify code - on enabling macro when opening workbook superscript macro automatically work for column C of sheet2 so selection is not required for every time.
Thanks & Regards
Raindrop
You made my work easy. Could you please modify code - on enabling macro when opening workbook superscript macro automatically work for column C of sheet2 so selection is not required for every time.
Thanks & Regards
Raindrop
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
Here is the code...
Make sure you put it in the ThisWorkbook module.
Make sure you put it in the ThisWorkbook module.
Code: Select all
Private Sub Workbook_Open()
Dim i As Long, rRng As Range
Set rRng = Worksheets(2).Range("C1", Worksheets(2).Range("C" & Rows.Count).End(xlUp).Cells)
Application.ScreenUpdating = False
For i = 1 To rRng.Count
rRng.Cells(i).Characters(Start:=rRng.Cells(i).Characters.Count, _
Length:=1).Font.Superscript = True
Next i
Application.ScreenUpdating = True
End Sub
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Lounger
- Posts: 36
- Joined: 04 Feb 2013, 06:22
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
Thank You Rudy sir,
Your code and formula both works great !
Thanks & Regards
Raindrop
Your code and formula both works great !
Thanks & Regards
Raindrop
-
- 2StarLounger
- Posts: 196
- Joined: 31 Mar 2011, 03:41
- Location: Perth, Western Australia
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
If the last number is always a 3, then a non-VBA solution is to replace 3 with ³ (Alt 0179 - hold down Alt key and enter 0179 using keypad)
regards
Becks
regards
Becks
-
- Lounger
- Posts: 36
- Joined: 04 Feb 2013, 06:22
Re: VBA Code To Turn Last Number Of Cell In Superscript Form
Thank You Sir for another option.
Thanks & Regards
Raindrop
Thanks & Regards
Raindrop