#1   Report Post  
Posted to microsoft.public.excel.misc
pinmaster
 
Posts: n/a
Default selection in VBA


Hi

Say I have 2 cells with values
BJ4 = 31
BJ5 = 3

how would I use those values in vba to select a range starting from a
specific cell (C4), in this case 31 rows tall by 3 columns wide then
copy and paste as values.

TIA

Jean-Guy


--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=515148

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default selection in VBA



with activesheet
with .range("C4").resize(.range("Bj4").value,.range("Bj 5").value)
.copy
.pastespecial paste:=xlpastevalues
end with
end with

pinmaster wrote:

Hi

Say I have 2 cells with values
BJ4 = 31
BJ5 = 3

how would I use those values in vba to select a range starting from a
specific cell (C4), in this case 31 rows tall by 3 columns wide then
copy and paste as values.

TIA

Jean-Guy

--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=515148


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
pinmaster
 
Posts: n/a
Default selection in VBA


Hi Dave, thanks for the help.
I just came up with this:

Dim r As Integer
Dim c As Integer
r = Range("BJ3").Value
c = Range("BJ4").Value
Range("C4").Select
Range(Selection, ActiveCell.Offset(r - 1, c - 1)).Select

but I think I will go with what you gave me...thanks again!

Regards

Jean-Guy


--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=515148

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
Add "left align across selection" cell formatting Monty Analyst Excel Worksheet Functions 2 November 5th 08 03:17 PM
Insert Picture from dropdown selection Mike at Channel New Users to Excel 21 March 22nd 06 01:14 AM
Selection mode problem Richard L. Trethewey New Users to Excel 2 November 23rd 05 07:45 PM
Max Value in a column exclude selection - Excel VBA magix Excel Discussion (Misc queries) 3 November 5th 05 09:18 PM
Cell Selection after "Enter" Synectica Excel Discussion (Misc queries) 6 August 29th 05 09:55 PM


All times are GMT +1. The time now is 06:52 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"