ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why do I get an error? (https://www.excelbanter.com/excel-programming/416414-why-do-i-get-error.html)

Charlotte E.

Why do I get an error?
 
Why do I get an error in the last linie of these 4 lines of code:


Dim Ark As Object
Set Ark = ActiveWorkbook.ActiveSheet

Dim Celle As Object
Set Celle = Ark.ActiveCell


Thanks...



Barb Reinhardt

Why do I get an error?
 
I'd probably write it like this

Dim Ark As Worksheet
Set Ark = ActiveWorkbook.ActiveSheet

Dim Celle As Range
Set Celle = Ark.ActiveCell
--
HTH,
Barb Reinhardt



"Charlotte E." wrote:

Why do I get an error in the last linie of these 4 lines of code:


Dim Ark As Object
Set Ark = ActiveWorkbook.ActiveSheet

Dim Celle As Object
Set Celle = Ark.ActiveCell


Thanks...




Dave Peterson

Why do I get an error?
 
Activecell applies to a window or the application.

Set Celle = Activecell

looks like what you want.



"Charlotte E." wrote:

Why do I get an error in the last linie of these 4 lines of code:

Dim Ark As Object
Set Ark = ActiveWorkbook.ActiveSheet

Dim Celle As Object
Set Celle = Ark.ActiveCell

Thanks...


--

Dave Peterson


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

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