Thread: VBA
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
dtb dtb is offline
external usenet poster
 
Posts: 3
Default VBA

You should avoid variants and you don't need them here. I'm not sure why you
need a VBA macro to do this but the following code will work. Just replace
the range reference to whatever you need it to be. This copies the data from
the first 10 rows and columns in sheet1 to the first 10 rows and columns in
sheet2.

ActiveWorkbook.Worksheets(1).Range("A1:J10").Copy _
ActiveWorkbook.Worksheets(2).Range("A1:J10")


"nick" wrote:

Can someone tell me what do i declare as a variant? i have a code to pupolate
data from one workbook in to the second. i have like 10 columns in my
workbook 2 and like 25 columns in workbook 1. i am trying to get the data for
the 10 columns in workbook 2 from the same cells in workbook 1. i got this
code off the internet but i dunno how to declare variants and ranges...can
someone help?