ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   impossible syntax?? (https://www.excelbanter.com/excel-programming/281923-impossible-syntax.html)

CG Rosén

impossible syntax??
 
Good Day,

Is the following approach a dead end? Must the range be in the format
("A1:A2")
to make this code work?

t =
Application.WorksheetFunction.CountA(Sheets("tele" ).Range(Cells(ActiveCell.R
ow, ActiveCell.Column + 79), Cells(ActiveCell.Row + 6, ActiveCell.Column +
79)))

Thanks for any help.

Brgds

CG Rosén



RADO[_3_]

impossible syntax??
 
I would use something like this instead:

Dim Target as range

Set Target = Sheets("tele").ActiveCell.Resize(6, 79)
t=Application.WorksheetFunction. CountA (Target)

Best -

RADO

"CG Rosén" wrote in message
...
Good Day,

Is the following approach a dead end? Must the range be in the format
("A1:A2")
to make this code work?

t =

Application.WorksheetFunction.CountA(Sheets("tele" ).Range(Cells(ActiveCell.R
ow, ActiveCell.Column + 79), Cells(ActiveCell.Row + 6, ActiveCell.Column +
79)))

Thanks for any help.

Brgds

CG Rosén





Tom Ogilvy

impossible syntax??
 
Dim Target as range

Set Target = Sheets("tele").Range( _
ActiveCell.offset(0,79).Resize(6, 1).Address(0,0))
t=Application.WorksheetFunction.CountA(Target)

might be closer to what the original code shows.

A worksheet does not have an activeCell property
The code is inconclusive on whether Tele is the active sheet
The cells references both add 79 to the activecell column value, so the
column width is 1, not 79 and is thus offset from the activecell


--
Regards,
Tom Ogilvy


RADO wrote in message
...
I would use something like this instead:

Dim Target as range

Set Target = Sheets("tele").ActiveCell.Resize(6, 79)
t=Application.WorksheetFunction. CountA (Target)

Best -

RADO

"CG Rosén" wrote in message
...
Good Day,

Is the following approach a dead end? Must the range be in the format
("A1:A2")
to make this code work?

t =


Application.WorksheetFunction.CountA(Sheets("tele" ).Range(Cells(ActiveCell.R
ow, ActiveCell.Column + 79), Cells(ActiveCell.Row + 6, ActiveCell.Column

+
79)))

Thanks for any help.

Brgds

CG Rosén







CG Rosén

impossible syntax??
 
Hi,

Thanks RADO and Tom Ogilvy for your answers, always a
pleasure to learn something new.

Brgds

CG Rosén






All times are GMT +1. The time now is 12:09 AM.

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