bearcub
Well-known Member
- Joined
- May 18, 2005
- Messages
- 711
- Office Version
- 365
- 2013
- 2010
- 2007
- Platform
- Windows
I'm just trying to figure out what is happening with the following code (which is useless). I'm getting an error message in the last line of code saying that the object property is not supported by the wk object (or something to this effect):
Sub Module()
Dim wk As Workbook
Set wk = ThisWorkbook
wk.ActiveSheet.value= "5"
End Sub
What I'm trying to do is open a workbook and then copy the sheet names in that file into the activeworkbook. Instead of using the actual file name in the code I'm using the variable wk to be the active workbook. I then add a line to open another file and make a copy list of all the sheets that are that file then paste them into the wk file on the active sheet. I was able to figure out how to do this but during the process I noticed that when I set the activeworkbook to "wk" I couldn't do something like this "wk.Activesheet.activecell.value = "5".
It seems that the intelliisense dropdown doesn't pop up after the activesheet object is added to the wk variable. All I can get to work for the activesheet object is "wk.activesheet". The above code definitely gives an error message when it gets to the last line because for some reason VBA doesn't recognize the .value property (it doesn't show up as a property in the activesheet object). Why is that? I noticed that a number of the workbook and worksheet properties/methods disappear I use the set statement. Why is that?
Michael
Sub Module()
Dim wk As Workbook
Set wk = ThisWorkbook
wk.ActiveSheet.value= "5"
End Sub
What I'm trying to do is open a workbook and then copy the sheet names in that file into the activeworkbook. Instead of using the actual file name in the code I'm using the variable wk to be the active workbook. I then add a line to open another file and make a copy list of all the sheets that are that file then paste them into the wk file on the active sheet. I was able to figure out how to do this but during the process I noticed that when I set the activeworkbook to "wk" I couldn't do something like this "wk.Activesheet.activecell.value = "5".
It seems that the intelliisense dropdown doesn't pop up after the activesheet object is added to the wk variable. All I can get to work for the activesheet object is "wk.activesheet". The above code definitely gives an error message when it gets to the last line because for some reason VBA doesn't recognize the .value property (it doesn't show up as a property in the activesheet object). Why is that? I noticed that a number of the workbook and worksheet properties/methods disappear I use the set statement. Why is that?
Michael