ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A One-liner (https://www.excelbanter.com/excel-programming/364803-one-liner.html)

T De Villiers[_24_]

A One-liner
 

Hi I think there is something wrong with "For Each wks In
ActiveWorkbook",
any help is much appreciated.


Sub taz()

Dim wks As Worksheet
Dim ActiveWorkbook As Workbook
For Each wks In ActiveWorkbook

If Cells(3, 1) = "taz" Then
Cells.Font.Bold = True

End If
Next wks
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=553558


Norman Jones

A One-liner
 
Hi T,

Try replacing:

Dim wks As Worksheet
Dim ActiveWorkbook As Workbook
For Each wks In ActiveWorkbook


with:

Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets


---
Regards,
Norman


"T De Villiers"
wrote in message
news:T.De.Villiers.29p6a0_1150801208.634@excelforu m-nospam.com...

Hi I think there is something wrong with "For Each wks In
ActiveWorkbook",
any help is much appreciated.


Sub taz()

Dim wks As Worksheet
Dim ActiveWorkbook As Workbook
For Each wks In ActiveWorkbook

If Cells(3, 1) = "taz" Then
Cells.Font.Bold = True

End If
Next wks
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile:
http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=553558





All times are GMT +1. The time now is 10:48 AM.

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