Thread: VBA syntax
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default VBA syntax

I like to let excel's vba take care of the syntax.

dim DestCell as range
set destcell = workbooks("myworkbook.xlsm").worksheets("sales").c ells(5,1)
or this--it doesn't matter if you use .cells() or .range()
set destcell = workbooks("myworkbook.xlsm").worksheets("sales").r ange("a5")
or
set destcell = activeworkbook.worksheets("sales").range("a5")
or (if you're running from the correct worksheet)
set destcell = activesheet.range("a5")

....tabledestination:=destcell.address(external:=t rue), ...




dhstein wrote:

I have some code in a macro that was recorded like this:
TableDestination:="[MyWorkbook.xlsm]Sales!R5C1"

I would like to replace Myworkbook.xlsm with "ActiveWorkbook

Is this the syntax:

TableDestination:="[ActiveWorkbook]Reorder!R5C1" ?

OR

TableDestination:="ActiveWorkbook.Reorder!R5C1"

OR something else?

Thanks for any help on this


--

Dave Peterson