Questions of Great Import

T

The Wonder Thing

Well... to me anyways...

O.k. First, is there a faster way to do this:

For Each c In ActiveSheet.UsedRange
If c.Formula Like "=*" Then
c.Font.Italic = True
Else
c.Font.Italic = False
End If
Next

And second, how do I do something For Each Sheet in Workbooks("This Workbook")? I've tried doing that, and it doesn't seem to be working.
 
C

Chip Pearson

Are you trying to make all cells with formulas italic? If so, use
the following line of code (all on one line)

ActiveSheet.UsedRange.SpecialCells(xlCellTypeFormulas).Font.Itali
c = True

You can iterate through worksheets with code like

Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
' do something with WS
Next WS


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"The Wonder Thing" <[email protected]>
wrote in message
Well... to me anyways...

O.k. First, is there a faster way to do this:

For Each c In ActiveSheet.UsedRange
If c.Formula Like "=*" Then
c.Font.Italic = True
Else
c.Font.Italic = False
End If
Next

And second, how do I do something For Each Sheet in
Workbooks("This Workbook")? I've tried doing that, and it doesn't
seem to be working.
 
Top