ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   With End With question (https://www.excelbanter.com/excel-programming/393154-end-question.html)

Steve

With End With question
 
The first routine (below) works, but when I try the second one, only the
paste funtion works. I don't understand why the activate and select funtions
don't work in the With End With routine. Can anyone explain this to me?
Thanks,
Steve

Sheets("Temp").Select
Range("A4").Paste
Range("A1").Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy

With wsTemp
.Range("A4").Paste
.Range("A1").Activate
.Range(ActiveCell, ActiveCell.End(xlDown)).Select
.Selection.Copy
End With

Gary Keramidas

With End With question
 
the sheet needs to be ative in order to select a cell.

if wstemp is the sheet, then just add
..activate


With wsTemp
.Range("A4").Paste
.activate
.Range("A1").Activate
.Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy

--


Gary


"Steve" wrote in message
...
The first routine (below) works, but when I try the second one, only the
paste funtion works. I don't understand why the activate and select funtions
don't work in the With End With routine. Can anyone explain this to me?
Thanks,
Steve

Sheets("Temp").Select
Range("A4").Paste
Range("A1").Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy

With wsTemp
.Range("A4").Paste
.Range("A1").Activate
.Range(ActiveCell, ActiveCell.End(xlDown)).Select
.Selection.Copy
End With




Steve

With End With question
 
Thanks, Gary, for clearing that up.

Steve

"Gary Keramidas" wrote:

the sheet needs to be ative in order to select a cell.

if wstemp is the sheet, then just add
..activate


With wsTemp
.Range("A4").Paste
.activate
.Range("A1").Activate
.Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy

--


Gary


"Steve" wrote in message
...
The first routine (below) works, but when I try the second one, only the
paste funtion works. I don't understand why the activate and select funtions
don't work in the With End With routine. Can anyone explain this to me?
Thanks,
Steve

Sheets("Temp").Select
Range("A4").Paste
Range("A1").Activate
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy

With wsTemp
.Range("A4").Paste
.Range("A1").Activate
.Range(ActiveCell, ActiveCell.End(xlDown)).Select
.Selection.Copy
End With






All times are GMT +1. The time now is 10:04 AM.

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