ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Questions of Great Import (https://www.excelbanter.com/excel-programming/301118-questions-great-import.html)

The Wonder Thing[_2_]

Questions of Great Import
 
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.

Chip Pearson

Questions of Great Import
 
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(xlCellTypeFormu las).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"
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.




All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com