ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Doesn't recognize worksheet (https://www.excelbanter.com/excel-programming/343059-doesnt-recognize-worksheet.html)

davegb

Doesn't recognize worksheet
 
Sub CountReasonContactCode()
Dim Wksht As Worksheet
Dim rReason As Range
Dim lRow As Long
Dim lCurRow As Long
Dim rCell As Range
Dim l16Rct As Long
Dim l16Act As Long
Dim l16BGct As Long
Dim lCt As Long
Dim lTotNameRow As Long



lRow = 107
lTotNameRow = 4
l16Rct = 0
l16Act = 0
l16BGct = 0

For Each Wksht In ActiveWorkbook <---ERROR

Doesn't recognize method or property error
Any suggestions?
Thanks!


Jim Thomlinson[_4_]

Doesn't recognize worksheet
 
Give this a try...

For Each Wksht In ActiveWorkbook.Worksheets
--
HTH...

Jim Thomlinson


"davegb" wrote:

Sub CountReasonContactCode()
Dim Wksht As Worksheet
Dim rReason As Range
Dim lRow As Long
Dim lCurRow As Long
Dim rCell As Range
Dim l16Rct As Long
Dim l16Act As Long
Dim l16BGct As Long
Dim lCt As Long
Dim lTotNameRow As Long



lRow = 107
lTotNameRow = 4
l16Rct = 0
l16Act = 0
l16BGct = 0

For Each Wksht In ActiveWorkbook <---ERROR

Doesn't recognize method or property error
Any suggestions?
Thanks!



George Nicholson[_2_]

Doesn't recognize worksheet
 
A Worksheet is not a member of Workbook (Workbook isn't a collection and has
no members).
A Worksheet is a member of the ActiveWorkbook.Worksheets collection.

For Each Wksht In ActiveWorkbook.Worksheets

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"davegb" wrote in message
oups.com...
Sub CountReasonContactCode()
Dim Wksht As Worksheet
Dim rReason As Range
Dim lRow As Long
Dim lCurRow As Long
Dim rCell As Range
Dim l16Rct As Long
Dim l16Act As Long
Dim l16BGct As Long
Dim lCt As Long
Dim lTotNameRow As Long



lRow = 107
lTotNameRow = 4
l16Rct = 0
l16Act = 0
l16BGct = 0

For Each Wksht In ActiveWorkbook <---ERROR

Doesn't recognize method or property error
Any suggestions?
Thanks!





All times are GMT +1. The time now is 04:16 AM.

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