hide sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Sub foo()
With Sheets("Sheet1")
.Range("A1").Copy
.Range("C1").PasteSpecial xlPasteAll
End With
Application.CutCopyMode = False
End Sub
 
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").PasteSpecial xlPasteAll
End Sub

regards
FSt1
 
You can do it with one command:

with worksheets("Sheet1")
.range("A1").Copy .Range("C1")
End With
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top