ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Resize issue (https://www.excelbanter.com/excel-programming/416227-resize-issue.html)

Simon[_2_]

Resize issue
 
HI everybody,

What is wrong with

export.Sheets("Sheet1").Range("C4").Resize(Range(" F4").End(xlDown).Row,
4).Select

Thanks

because

export.Activate
Range("C4").Resize(Range("F4").End(xlDown).Row, 4).Select
Selection.Copy
AllJobVolumes.Activate

works?!

Don Guillett

Resize issue
 

If the other works then no selections necessary

export.Sheets("Sheet1").Range("C4").Resize(Range(" F4").End(xlDown).Row,4).COPY

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Simon" wrote in message
...
HI everybody,

What is wrong with

export.Sheets("Sheet1").Range("C4").Resize(Range(" F4").End(xlDown).Row,
4).Select

Thanks

because

export.Activate
Range("C4").Resize(Range("F4").End(xlDown).Row, 4).Select
Selection.Copy
AllJobVolumes.Activate

works?!



Gary Keramidas

Resize issue
 
maybe sheet1 is not the active sheet. no need to select, anyway, you're better
off without it.

--


Gary


"Simon" wrote in message
...
HI everybody,

What is wrong with

export.Sheets("Sheet1").Range("C4").Resize(Range(" F4").End(xlDown).Row,
4).Select

Thanks

because

export.Activate
Range("C4").Resize(Range("F4").End(xlDown).Row, 4).Select
Selection.Copy
AllJobVolumes.Activate

works?!




Dave Peterson

Resize issue
 
Is F4 you're using on the same sheet as C4?

export.Sheets("Sheet1").Range("C4") _
.Resize(export.Sheets("Sheet1").Range("F4").End(xl Down).Row, 4).Select

And the export workbook has to be active
and sheets("sheet1") has to be active/selected

or

with export.sheets("sheet1")
application.goto .range("C4").resize(.range("F4").end(xldown).row, 4), _
scroll:=true 'or false
end with

And you don't have to worry about what workbook and what worksheet is active.

The "with" statement makes it less stuff to type -- and easier to understand for
me.

Simon wrote:

HI everybody,

What is wrong with

export.Sheets("Sheet1").Range("C4").Resize(Range(" F4").End(xlDown).Row,
4).Select

Thanks

because

export.Activate
Range("C4").Resize(Range("F4").End(xlDown).Row, 4).Select
Selection.Copy
AllJobVolumes.Activate

works?!


--

Dave Peterson


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

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