• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I am facing problem while defining worksheet.

ThrottleWorks

Excel Ninja
Hi,


I am facing following problem while trying to define a worksheet.

I am getting Run - Time error 438

Object doesn’t support this property or method


I am trying to define sheet named as working, I am using following code.

Dim wrk as worksheet

Set wrk = worksheets(“Working”)


Can anyone help me in understanding this error.


After defining the code, I am replacing worksheets(“Working”) with wrk but not able to do so.
 
Hi Brant Sir, thank a lot for the reply.


Here is the line


macro.wrk.range ("a1").value = from_date


Please note - macro is defined workbook & code related to macro is running fine.
 
Sure thing..


If you remove "macro." from the beginning of the line, your code should run. When you set 'wrk = worksheets("Working")', Excel knows the workbook that the worksheet is in. So, by adding your definied workbook variable to the beginning of 'wrk.range("A1")', you are essentially telling Excel 'Workbook.Workbook.Worksheet.Range("A1").'


Let me know if that works for you!
 
Back
Top