Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Can i use the cell colors as logical tests? kashof Excel Worksheet Functions 2 January 15th 08 08:41 PM
Two Logic tests in an IF Statement timmadge Excel Worksheet Functions 2 February 7th 06 03:15 PM
If statement - 2 tests RobertLees Excel Worksheet Functions 1 September 1st 05 11:10 AM
Average a group of tests for grade, some tests not taken by all. Scafidel Excel Discussion (Misc queries) 4 August 19th 05 03:50 AM
Cell tests for upper case, and certain #'s Bob Phillips[_6_] Excel Programming 1 April 14th 05 09:41 PM


All times are GMT +1. The time now is 02:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"