View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copy pasting a range in to a single column

Worksheets("2") refers to a sheet that has a tab name of 2

worksheets(2) refers to the sheet that is second in the tab order

the code name has nothing to do with either of these and does not work with
the Worksheets collection.

code name is an alternate way to refer to a worksheet

Sheet1.Range("a1").Value = 3

If you look in the project explorer (in the VBE) you will see entries like

sheet1 (Jobs)

Jobs is the tab name of the worksheets and is used with the worksheets
collection. Sheet1 is the code name.

When you first open a workbook the code name and tab name probably will
match. (they do in US English anyway).

--
Regards,
Tom Ogilvy

"Hari Prasadh" wrote in message
...
Hi RBS,

Thnx for your code.

Just a ..Presently your code is copying data only up to the column based

on
row number 2's non empty column. So, if I have data till column Q for row
number 2 and if any of the rest of the rows I have data beyond column Q ,
then data till column Q only is considered. Also the macro is copying
entries column wise.. That is all the non-empty entries in column O, then

P
and so on. In the present case I prefer a row wise copying macro, which

Nick
has provided.

One syntax related doubts in your code. You have used -- With

Sheets(2) --
in your code. I have never come across a numeral within sheets(), I have
seen it to be a string or a string surrounded by quotations. Is this 2

same
as the code name reference used by Excel (I first came across this code

name
reference , yesterday, while browsing through one of J Peltier's article).
Is there some source where I may read a little bit about what this code

name
is about.

Thanks a lot,
Hari
India