Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Change font to Italic

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Change font to Italic

David,

I didn't understand the range you wanted to work on
cells with red fonts to italics and underline them from cell A2 through Q

so this has a line that will work for A2 - Q100 and another that will work
on the entire used range so use which you prefer.

Right click the sheet tab, view code and paste this in.

Sub Prime_Lending()
ActiveSheet.Range("A2:Q100").SpecialCells(xlCellTy peConstants,
xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each c In Selection
If c.Font.ColorIndex = 3 Then
With c.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub


Mike

"DavidH56" wrote:

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Change font to Italic

Thanks Mike for such a fast response,

My mistake, I meant used range because row amounts change each week. Is
there a way to run this in a macro so for my weekly the final report?

Thanks again
--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I didn't understand the range you wanted to work on
cells with red fonts to italics and underline them from cell A2 through Q

so this has a line that will work for A2 - Q100 and another that will work
on the entire used range so use which you prefer.

Right click the sheet tab, view code and paste this in.

Sub Prime_Lending()
ActiveSheet.Range("A2:Q100").SpecialCells(xlCellTy peConstants,
xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each c In Selection
If c.Font.ColorIndex = 3 Then
With c.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub


Mike

"DavidH56" wrote:

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Change font to Italic

David,

I assume you have pasted the macro into the worksheet code module as
indicated below. If you have there are a couple of ways to run it.

Tools|Macro|Select this workbook|Highlight the macro name|Run

or

View|Toolbars|Forms
Click the 'Button' icon
Hover your cursor on the worksheet where you want the button
Left click and drag a button onto the worksheet
In the popup window assign the macro
Click the button

Mike

"DavidH56" wrote:

Thanks Mike for such a fast response,

My mistake, I meant used range because row amounts change each week. Is
there a way to run this in a macro so for my weekly the final report?

Thanks again
--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I didn't understand the range you wanted to work on
cells with red fonts to italics and underline them from cell A2 through Q

so this has a line that will work for A2 - Q100 and another that will work
on the entire used range so use which you prefer.

Right click the sheet tab, view code and paste this in.

Sub Prime_Lending()
ActiveSheet.Range("A2:Q100").SpecialCells(xlCellTy peConstants,
xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each c In Selection
If c.Font.ColorIndex = 3 Then
With c.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub


Mike

"DavidH56" wrote:

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Change font to Italic

Mike,

I keep getting an error variable not defined in this line:
If c.Font.ColorIndex = 3 Then


--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I assume you have pasted the macro into the worksheet code module as
indicated below. If you have there are a couple of ways to run it.

Tools|Macro|Select this workbook|Highlight the macro name|Run

or

View|Toolbars|Forms
Click the 'Button' icon
Hover your cursor on the worksheet where you want the button
Left click and drag a button onto the worksheet
In the popup window assign the macro
Click the button

Mike

"DavidH56" wrote:

Thanks Mike for such a fast response,

My mistake, I meant used range because row amounts change each week. Is
there a way to run this in a macro so for my weekly the final report?

Thanks again
--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I didn't understand the range you wanted to work on
cells with red fonts to italics and underline them from cell A2 through Q
so this has a line that will work for A2 - Q100 and another that will work
on the entire used range so use which you prefer.

Right click the sheet tab, view code and paste this in.

Sub Prime_Lending()
ActiveSheet.Range("A2:Q100").SpecialCells(xlCellTy peConstants,
xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each c In Selection
If c.Font.ColorIndex = 3 Then
With c.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub


Mike

"DavidH56" wrote:

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Change font to Italic

Add this as the first line

Dim c As Range


Mike

"DavidH56" wrote:

Mike,

I keep getting an error variable not defined in this line:
If c.Font.ColorIndex = 3 Then


--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I assume you have pasted the macro into the worksheet code module as
indicated below. If you have there are a couple of ways to run it.

Tools|Macro|Select this workbook|Highlight the macro name|Run

or

View|Toolbars|Forms
Click the 'Button' icon
Hover your cursor on the worksheet where you want the button
Left click and drag a button onto the worksheet
In the popup window assign the macro
Click the button

Mike

"DavidH56" wrote:

Thanks Mike for such a fast response,

My mistake, I meant used range because row amounts change each week. Is
there a way to run this in a macro so for my weekly the final report?

Thanks again
--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I didn't understand the range you wanted to work on
cells with red fonts to italics and underline them from cell A2 through Q
so this has a line that will work for A2 - Q100 and another that will work
on the entire used range so use which you prefer.

Right click the sheet tab, view code and paste this in.

Sub Prime_Lending()
ActiveSheet.Range("A2:Q100").SpecialCells(xlCellTy peConstants,
xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each c In Selection
If c.Font.ColorIndex = 3 Then
With c.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub


Mike

"DavidH56" wrote:

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Change font to Italic

Mike,

Thanks so much for your help. I put in your statement and it ran, but I had
not realized that some of the rows were hidden and filtered, so it ran but
skipped over some of the visible columns. I modified it a little and it
worked. This is what I have:

Sub Prime_Lending()

Dim C As Range

Range("A1:Q1").Select
Range(Selection, Selection.End(xlDown)).Select
'ActiveSheet.Range("A2:Q2000").SpecialCells(xlCell TypeConstants, _
'xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each C In Selection
If C.Font.ColorIndex = 3 Then
With C.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub

This seems to work okay.

Thanks again for your help.

DH
--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

Add this as the first line

Dim c As Range


Mike

"DavidH56" wrote:

Mike,

I keep getting an error variable not defined in this line:
If c.Font.ColorIndex = 3 Then


--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I assume you have pasted the macro into the worksheet code module as
indicated below. If you have there are a couple of ways to run it.

Tools|Macro|Select this workbook|Highlight the macro name|Run

or

View|Toolbars|Forms
Click the 'Button' icon
Hover your cursor on the worksheet where you want the button
Left click and drag a button onto the worksheet
In the popup window assign the macro
Click the button

Mike

"DavidH56" wrote:

Thanks Mike for such a fast response,

My mistake, I meant used range because row amounts change each week. Is
there a way to run this in a macro so for my weekly the final report?

Thanks again
--
By persisting in your path, though you forfeit the little, you gain the
great.



"Mike H" wrote:

David,

I didn't understand the range you wanted to work on
cells with red fonts to italics and underline them from cell A2 through Q
so this has a line that will work for A2 - Q100 and another that will work
on the entire used range so use which you prefer.

Right click the sheet tab, view code and paste this in.

Sub Prime_Lending()
ActiveSheet.Range("A2:Q100").SpecialCells(xlCellTy peConstants,
xlTextValues).Select
'ActiveSheet.UsedRange.SpecialCells(xlCellTypeCons tants, xlTextValues).Select
For Each c In Selection
If c.Font.ColorIndex = 3 Then
With c.Font
.FontStyle = "Italic"
.Underline = xlUnderlineStyleSingle
End With
End If
Next
End Sub


Mike

"DavidH56" wrote:

Hi,

Could anyone please let me know how would I programmically to change all
cells with red fonts to italics and underline them from cell A2 through Q
with variable rows?

Thanks in advance.
--
By persisting in your path, though you forfeit the little, you gain the
great.

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
Font/Color/Bold/Italic Remain Same dberger16 Excel Discussion (Misc queries) 2 January 21st 09 08:36 PM
Macro to Simulate CF Italic Red Font based on Formula Criteria Sam via OfficeKB.com Excel Programming 0 May 31st 07 09:53 PM
Macro to Simulate CF Italic Red Font based on Formula Criteria Sam Excel Programming 0 May 29th 07 07:33 PM
Lookup and change to italic italic Doug Excel Worksheet Functions 2 October 30th 06 01:39 PM
change format of cells (bold, italic) based on one cell's answer Jabi Excel Discussion (Misc queries) 4 May 25th 06 12:33 PM


All times are GMT +1. The time now is 01:06 PM.

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

About Us

"It's about Microsoft Excel"