#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default hide sheet

hi,

i have some programming in sheet1 like:

range("A1").select
selection.copy
range("C1").select
selection.paste

right now the code only works if i make the code go to the sheet firt like:
sheets("sheet1").select

i would like to know how i can stay on my current sheet_new and have the
code execute without having to actually go to or put focus on sheet1 as made
possible by the sheets("sheet1").select


thanks in advance,
geebee

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default hide sheet

Sub foo()
With Sheets("Sheet1")
.Range("A1").Copy
.Range("C1").PasteSpecial xlPasteAll
End With
Application.CutCopyMode = False
End Sub

geebee noSPAMs wrote:
hi,

i have some programming in sheet1 like:

range("A1").select
selection.copy
range("C1").select
selection.paste

right now the code only works if i make the code go to the sheet firt like:
sheets("sheet1").select

i would like to know how i can stay on my current sheet_new and have the
code execute without having to actually go to or put focus on sheet1 as made
possible by the sheets("sheet1").select


thanks in advance,
geebee


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default hide sheet

hi,
with the code you have, it assumes that your are talking about the current
sheet. to do something on another sheet, you have to specify which sheets.

Sub copyit()
Activeworkbook.sheets("sheet1").select
ActiveWorkbook.Sheets("sheet2").Range("A1").Copy
ActiveWorkbook.Sheets("sheet2").Range("A2").PasteS pecial xlPasteAll
End Sub

regards
FSt1
"geebee" wrote:

hi,

i have some programming in sheet1 like:

range("A1").select
selection.copy
range("C1").select
selection.paste

right now the code only works if i make the code go to the sheet firt like:
sheets("sheet1").select

i would like to know how i can stay on my current sheet_new and have the
code execute without having to actually go to or put focus on sheet1 as made
possible by the sheets("sheet1").select


thanks in advance,
geebee

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default hide sheet

You can do it with one command:

with worksheets("Sheet1")
.range("A1").Copy .Range("C1")
End With


--
Regards,
Tom Ogilvy


"geebee" wrote:

hi,

i have some programming in sheet1 like:

range("A1").select
selection.copy
range("C1").select
selection.paste

right now the code only works if i make the code go to the sheet firt like:
sheets("sheet1").select

i would like to know how i can stay on my current sheet_new and have the
code execute without having to actually go to or put focus on sheet1 as made
possible by the sheets("sheet1").select


thanks in advance,
geebee

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default hide sheet

this is a good way to avoind the sheet apearing during a copy operation, but
what about an operation like programatically hiding a pivot table value?



"Tom Ogilvy" wrote:

You can do it with one command:

with worksheets("Sheet1")
.range("A1").Copy .Range("C1")
End With


--
Regards,
Tom Ogilvy


"geebee" wrote:

hi,

i have some programming in sheet1 like:

range("A1").select
selection.copy
range("C1").select
selection.paste

right now the code only works if i make the code go to the sheet firt like:
sheets("sheet1").select

i would like to know how i can stay on my current sheet_new and have the
code execute without having to actually go to or put focus on sheet1 as made
possible by the sheets("sheet1").select


thanks in advance,
geebee

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
Create Sheet, Hide Sheet Dave Excel Discussion (Misc queries) 2 October 30th 07 03:40 PM
hide sheet name/ Tab Anand vijay New Users to Excel 7 January 7th 07 12:30 AM
hide sheet hitesh via OfficeKB.com Excel Discussion (Misc queries) 3 October 20th 06 02:51 PM
Hide a sheet gavin Excel Discussion (Misc queries) 1 September 14th 05 06:40 PM
hide sheet? uncheck sheet tabs? or ??? NetComm888 Excel Programming 1 February 10th 04 04:38 AM


All times are GMT +1. The time now is 07:22 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"