ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   why!? (https://www.excelbanter.com/excel-programming/288526-why.html)

Rui[_2_]

why!?
 
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..

Chip Pearson

why!?
 
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


"Rui" wrote in message
...
hi everyone

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

work:

Private Sub botao_m1_Click()

Application.ScreenUpdating = False

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




pikus

why!?
 
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


---
Message posted from http://www.ExcelForum.com/


Rui[_2_]

why!?
 
thanks, Chip.
that's it

Bob Phillips[_6_]

why!?
 
What do you get?

--

HTH

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

"Rui" wrote in message
...
hi everyone

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

Private Sub botao_m1_Click()

Application.ScreenUpdating = False

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





All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com