![]() |
if statement that tests format of cell
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 |
if statement that tests format of cell
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 |
if statement that tests format of cell
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 |
if statement that tests format of cell
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 |
if statement that tests format of cell
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 |
All times are GMT +1. The time now is 10:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com