Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Hari Prasadh
 
Posts: n/a
Default Operating on hidden sheets

Hi,

Let's say I have a "Sheet1" which is hidden.

Programmatically WITHOUT UNHIDING the above sheet, I go ahead and write
sheet1.activate
Range(Cells(1, 1), Cells(5000, 1)).Select
ActiveSheet.Paste

The debugger does not give me any error at the statement --
sheet1.activate -- but neither it is activating sheet1, rather a sheet
(sheet2)which is already active is selected and within sheet2's range
(A1:A5000) the data is pasted.

Why is it behaving like this? Either it should paste the data in Sheet1 or
it should give me an error saying that a hidden sheet cannot be activated.
Is there a logic for the present behaviour?

(Pls. note I can programmatically unhide the sheet, do the desired copy,
paste operation and then again hide it but my question is from understanding
point of view)

Thanks a lot,
Hari
India


  #2   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

But whi to activate the sheet at all?

....
Sheets("Sheet2").Range("A1").Offset(5000, 0).Copy
Sheets("Sheet1").Range("A1").Offset(5000, 0).PasteSpecial
Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
....

--
When sending mail, use address arvil<attarkon.ee
Arvi Laanemets


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

Let's say I have a "Sheet1" which is hidden.

Programmatically WITHOUT UNHIDING the above sheet, I go ahead and write
sheet1.activate
Range(Cells(1, 1), Cells(5000, 1)).Select
ActiveSheet.Paste

The debugger does not give me any error at the statement --
sheet1.activate -- but neither it is activating sheet1, rather a sheet
(sheet2)which is already active is selected and within sheet2's range
(A1:A5000) the data is pasted.

Why is it behaving like this? Either it should paste the data in Sheet1 or
it should give me an error saying that a hidden sheet cannot be activated.
Is there a logic for the present behaviour?

(Pls. note I can programmatically unhide the sheet, do the desired copy,
paste operation and then again hide it but my question is from

understanding
point of view)

Thanks a lot,
Hari
India




  #3   Report Post  
Rob van Gelder
 
Posts: n/a
Default

Try this:

With Worksheets("Sheet1")
Range(.Cells(1, 1), .Cells(5000, 1)).PasteSpecial
End With

--
Rob van Gelder - http://www.vangelder.co.nz/excel


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

Let's say I have a "Sheet1" which is hidden.

Programmatically WITHOUT UNHIDING the above sheet, I go ahead and write
sheet1.activate
Range(Cells(1, 1), Cells(5000, 1)).Select
ActiveSheet.Paste

The debugger does not give me any error at the statement --
sheet1.activate -- but neither it is activating sheet1, rather a sheet
(sheet2)which is already active is selected and within sheet2's range
(A1:A5000) the data is pasted.

Why is it behaving like this? Either it should paste the data in Sheet1 or
it should give me an error saying that a hidden sheet cannot be activated.
Is there a logic for the present behaviour?

(Pls. note I can programmatically unhide the sheet, do the desired copy,
paste operation and then again hide it but my question is from
understanding point of view)

Thanks a lot,
Hari
India



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy comments to several sheets in a workbook? jen_l_333 Excel Worksheet Functions 1 January 7th 05 10:30 PM
Hidden page bracks in Excel should be deactivated Tonywww Excel Discussion (Misc queries) 0 December 21st 04 06:21 PM
Multiple sheets selected twa14 Excel Discussion (Misc queries) 2 December 21st 04 11:15 AM
Linking sheets to a summary sheet in workbook gambinijr Excel Discussion (Misc queries) 4 December 16th 04 08:13 PM
How do I unhide multiple sheets? ahonig Excel Worksheet Functions 3 December 14th 04 09:03 PM


All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"