Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Resize problem

Hi, I am trying to copy cell B1 and them select B2 to B6 by code. So far, I
fail by using this.

Selection.Resize(Range("A1").End(xlDown).Row).past e

How can I code it?

A B C
1 4 Select Copy
2 2
3 4
4 5
5 14
6 9
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Resize problem

Hi

Try this:

LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy
ActiveSheet.Paste Range("B2:B" & LastRow)

or

LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy Destination:= Range("B2:B" & LastRow)

Regards,
Per

"Mathieu" skrev i meddelelsen
...
Hi, I am trying to copy cell B1 and them select B2 to B6 by code. So far,
I
fail by using this.

Selection.Resize(Range("A1").End(xlDown).Row).past e

How can I code it?

A B C
1 4 Select Copy
2 2
3 4
4 5
5 14
6 9


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Resize problem

Hi, thanks, it's working partially to what I need. What if it's not always B1
but instead I want to have the ability to chose the cell I need by using this
Range("A1").End(xlDown) or something like that.

Thanks!
--
Mathieu


"Per Jessen" wrote:

Hi

Try this:

LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy
ActiveSheet.Paste Range("B2:B" & LastRow)

or

LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy Destination:= Range("B2:B" & LastRow)

Regards,
Per

"Mathieu" skrev i meddelelsen
...
Hi, I am trying to copy cell B1 and them select B2 to B6 by code. So far,
I
fail by using this.

Selection.Resize(Range("A1").End(xlDown).Row).past e

How can I code it?

A B C
1 4 Select Copy
2 2
3 4
4 5
5 14
6 9



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Resize problem

Hi.

I made a few "trial and error" and I have modified the code a little bit. Do
ou see any problem with this code? and can you briefly explain the "long"
variable, what is i's use? Thanks a lot.

Sub Test2()

Dim lngRows As Long
Dim SRng As Range

lngRows = Range("A1").End(xlDown).Row - 2
Set SRng = Range("A1").End(xlToRight).Offset(2, 0).Resize(lngRows)
SRng.Select 'just for testing

End Sub
--
Mathieu


"Mathieu" wrote:

Hi, thanks, it's working partially to what I need. What if it's not always B1
but instead I want to have the ability to chose the cell I need by using this
Range("A1").End(xlDown) or something like that.

Thanks!
--
Mathieu


"Per Jessen" wrote:

Hi

Try this:

LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy
ActiveSheet.Paste Range("B2:B" & LastRow)

or

LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy Destination:= Range("B2:B" & LastRow)

Regards,
Per

"Mathieu" skrev i meddelelsen
...
Hi, I am trying to copy cell B1 and them select B2 to B6 by code. So far,
I
fail by using this.

Selection.Resize(Range("A1").End(xlDown).Row).past e

How can I code it?

A B C
1 4 Select Copy
2 2
3 4
4 5
5 14
6 9



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Resize problem

Hi

I don't see any problems with your code, but I don't know which cells
you expect to be selected.

"Long" is a 4-byte integer ranging in value from -2,147,483,648 to
2,147,483,647
"Integer" is a data type that holds integer variables stored as 2-byte
whole numbers in the range -32,768 to 32,767

Regards,
Per

On 18 Nov., 22:48, Mathieu wrote:
Hi.

I made a few "trial and error" and I have modified the code a little bit. Do
ou see any problem with this code? and can you briefly explain the "long"
variable, what is i's use? Thanks a lot.

Sub Test2()

Dim lngRows * * * * As Long
Dim SRng * * * * * *As Range

* *lngRows = Range("A1").End(xlDown).Row - 2
* *Set SRng = Range("A1").End(xlToRight).Offset(2, 0).Resize(lngRows)
* *SRng.Select * 'just for testing

End Sub
--
Mathieu



"Mathieu" wrote:
Hi, thanks, it's working partially to what I need. What if it's not always B1
but instead I want to have the ability to chose the cell I need by using this
Range("A1").End(xlDown) or something like that.


Thanks!
--
Mathieu


"PerJessen" wrote:


Hi


Try this:


LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy
ActiveSheet.Paste Range("B2:B" & LastRow)


or


LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy Destination:= Range("B2:B" & LastRow)


Regards,
Per


"Mathieu" skrev i meddelelsen
...
Hi, I am trying to copy cell B1 and them select B2 to B6 by code. So far,
I
fail by using this.


Selection.Resize(Range("A1").End(xlDown).Row).past e


How can I code it?


* * * *A * * * * * * * *B * * * * * * * * * * *C
1 * * *4 * * * * * * *Select Copy
2 * * *2
3 * * *4
4 * * *5
5 * * 14
6 * * *9- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Resize problem

Thank you!
--
Mathieu Bouffard


"Per Jessen" wrote:

Hi

I don't see any problems with your code, but I don't know which cells
you expect to be selected.

"Long" is a 4-byte integer ranging in value from -2,147,483,648 to
2,147,483,647
"Integer" is a data type that holds integer variables stored as 2-byte
whole numbers in the range -32,768 to 32,767

Regards,
Per

On 18 Nov., 22:48, Mathieu wrote:
Hi.

I made a few "trial and error" and I have modified the code a little bit. Do
ou see any problem with this code? and can you briefly explain the "long"
variable, what is i's use? Thanks a lot.

Sub Test2()

Dim lngRows As Long
Dim SRng As Range

lngRows = Range("A1").End(xlDown).Row - 2
Set SRng = Range("A1").End(xlToRight).Offset(2, 0).Resize(lngRows)
SRng.Select 'just for testing

End Sub
--
Mathieu



"Mathieu" wrote:
Hi, thanks, it's working partially to what I need. What if it's not always B1
but instead I want to have the ability to chose the cell I need by using this
Range("A1").End(xlDown) or something like that.


Thanks!
--
Mathieu


"PerJessen" wrote:


Hi


Try this:


LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy
ActiveSheet.Paste Range("B2:B" & LastRow)


or


LastRow = Range("A1").End(xlDown).Row
Range("B1").Copy Destination:= Range("B2:B" & LastRow)


Regards,
Per


"Mathieu" skrev i meddelelsen
...
Hi, I am trying to copy cell B1 and them select B2 to B6 by code. So far,
I
fail by using this.


Selection.Resize(Range("A1").End(xlDown).Row).past e


How can I code it?


A B C
1 4 Select Copy
2 2
3 4
4 5
5 14
6 9- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize Problem GregR Excel Programming 12 June 2nd 06 09:07 PM
Problem transferring array data onto worksheet using Resize Ken Johnson Excel Programming 13 December 20th 05 02:05 AM
having problem with resize Logan[_2_] Excel Programming 1 April 2nd 04 12:56 AM
problem with resize property Michelle Excel Programming 4 February 23rd 04 02:11 PM
Resize Range Problem ExcelMonkey[_16_] Excel Programming 3 January 23rd 04 11:15 PM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"