Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to create an if statement that tests the format of the
cell in addition to the value in the cell; specifically I want to test if the format of the text in the cell is superscript or not. I have been trying everything I know and this is what I have so far: ElseIf Trim(ActiveCell.Value) = "2" And Cells(ActiveCell.Value).FontStyle.Superscript = True Then sData = "0" Any help you could provide would be very much appreciated. Matt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Public Function TestFont(cellAddress As Range) As Boolean
If cellAddress.Font.Superscript = True Then TestFont = True Else TestFont = False End If End Function "medcmatt" schreef in bericht ps.com... I am trying to create an if statement that tests the format of the cell in addition to the value in the cell; specifically I want to test if the format of the text in the cell is superscript or not. I have been trying everything I know and this is what I have so far: ElseIf Trim(ActiveCell.Value) = "2" And Cells(ActiveCell.Value).FontStyle.Superscript = True Then sData = "0" Any help you could provide would be very much appreciated. Matt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I used this and it seems to work:
If ActiveCell.Value = 2 And ActiveCell.Font.Superscript = True Then MsgBox "boo" Else MsgBox "not boo" End If I think the problem that you were hitting has to do with your referencing in the cells()... cells(activecell.value) , in that case, would pick up the 2 cell in the index... the value of your active cell was 2, so activecell.value would then be 2, so essentially, your code says cells(2).fontstyle.superscript "medcmatt" wrote: I am trying to create an if statement that tests the format of the cell in addition to the value in the cell; specifically I want to test if the format of the text in the cell is superscript or not. I have been trying everything I know and this is what I have so far: ElseIf Trim(ActiveCell.Value) = "2" And Cells(ActiveCell.Value).FontStyle.Superscript = True Then sData = "0" Any help you could provide would be very much appreciated. Matt |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 4, 3:34 pm, mark wrote:
I used this and it seems to work: If ActiveCell.Value = 2 And ActiveCell.Font.Superscript = True Then MsgBox "boo" Else MsgBox "not boo" End If I think the problem that you were hitting has to do with your referencing in the cells()... cells(activecell.value) , in that case, would pick up the 2 cell in the index... the value of your active cell was 2, so activecell.value would then be 2, so essentially, your code says cells(2).fontstyle.superscript "medcmatt" wrote: I am trying to create an if statement that tests the format of the cell in addition to the value in the cell; specifically I want to test if the format of the text in the cell is superscript or not. I have been trying everything I know and this is what I have so far: ElseIf Trim(ActiveCell.Value) = "2" And Cells(ActiveCell.Value).FontStyle.Superscript = True Then sData = "0" Any help you could provide would be very much appreciated. Matt- Hide quoted text - - Show quoted text - Thanks mark. I tried your suggestion and it seems to work perfectly. I knew it had to be something pretty simple but thanks again. Thank you to everyone else who gave me sugestions as well. Mattt |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mon, 04 Jun 2007 12:02:40 -0700, medcmatt wrote:
I am trying to create an if statement that tests the format of the cell in addition to the value in the cell; specifically I want to test if the format of the text in the cell is superscript or not. I have been trying everything I know and this is what I have so far: ElseIf Trim(ActiveCell.Value) = "2" And Cells(ActiveCell.Value).FontStyle.Superscript = True Then sData = "0" Any help you could provide would be very much appreciated. Matt For Each c In Selection Debug.Print c.Address, c.Font.Superscript Next c --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How Can i use the cell colors as logical tests? | Excel Worksheet Functions | |||
Two Logic tests in an IF Statement | Excel Worksheet Functions | |||
If statement - 2 tests | Excel Worksheet Functions | |||
Average a group of tests for grade, some tests not taken by all. | Excel Discussion (Misc queries) | |||
Cell tests for upper case, and certain #'s | Excel Programming |