I wanted to copy something from one sheet to a different sheet
This is what I got, which works
Surely this is not the best practice Isnt' there something similar to:
Also, am I doing something wrong with the set command. I thought if I do:
set book = workbooks("larry")
I could do book.range(somernage)
and if I do
set somerange = range(soemrange)
then I can do
somerange.values = "soemthing"
somerange.select
etc.
and if I have a name such as "newname" defined in the worksheet, thsi works:
worksheets(someworksheet).range("newname")
but this doesn't
worksheets(someworksheet).newname
Am I missing something fundamental? The way I'm using this language is really verbose
This is what I got, which works
Code:
set this = activeworkbook
workbooks.open filename:="file.xls"
activeworkbook.worksheets("Sheet 1").select
range(somerange).select
selection.copy
this.activate
worksheets(somesheet).select
range(somerange).select
selection.paste
Surely this is not the best practice Isnt' there something similar to:
Code:
set this = activeworkbook 'Amazingly, Me doesn't work
dim openfile = new workbooks
openfile.open filename:="file.xls"
openfile.worksheets("Sheet 1").Range(somerange).copy
this.worksheets("Sheet 1").Range(somerange).paste
Also, am I doing something wrong with the set command. I thought if I do:
set book = workbooks("larry")
I could do book.range(somernage)
and if I do
set somerange = range(soemrange)
then I can do
somerange.values = "soemthing"
somerange.select
etc.
and if I have a name such as "newname" defined in the worksheet, thsi works:
worksheets(someworksheet).range("newname")
but this doesn't
worksheets(someworksheet).newname
Am I missing something fundamental? The way I'm using this language is really verbose