#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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..
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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..



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default why!?

thanks, Chip.
that's it
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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..



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



All times are GMT +1. The time now is 11:38 AM.

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"