why!?

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

Guest

hi everyon

i´m trying to get this commandbutton (that is in sheets(1)) to work

Private Sub botao_m1_Click(

Application.ScreenUpdating = Fals

Sheets(4).Selec
Range("K15").Selec
Selection.Cop
Range("M15").Selec
Selection.PasteSpecial Paste:=xlPasteValue
etc..
 
Rui,

Because the code is in the sheet's code module, you must prefix
the Range objects with the sheet name if the range is not in the
sheet containing the code.

Sheets(4).Select
Sheets(4).Range("K15").Select
Selection.Copy
Sheets(4).Range("M15").Select
Selection.PasteSpecial Paste:=xlPasteValues


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
I recommend going about this differeently.

Worksheets(4).Cells(15, 13).Value = _
Worksheets(4).Cells(15, 11).Value

This will work and be much faster than what you are currently trying to
do. - Pikus
 
What do you get?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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