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: www.excelforum.com/member.php...foamp;userid=6261
View this thread: www.excelforum.com/showthread...hreadid=515148
with activesheet
with .range(quot;C4quot;).resize(.range(quot;Bj4quot;).value,.range(quot;Bj 5quot;).value)
.copy
.pastespecial paste:=xlpastevalues
end with
end with
pinmaster wrote:
gt;
gt; Hi
gt;
gt; Say I have 2 cells with values
gt; BJ4 = 31
gt; BJ5 = 3
gt;
gt; how would I use those values in vba to select a range starting from a
gt; specific cell (C4), in this case 31 rows tall by 3 columns wide then
gt; copy and paste as values.
gt;
gt; TIA
gt;
gt; Jean-Guy
gt;
gt; --
gt; pinmaster
gt; ------------------------------------------------------------------------
gt; pinmaster's Profile: www.excelforum.com/member.php...foamp;userid=6261
gt; View this thread: www.excelforum.com/showthread...hreadid=515148
--
Dave Peterson
Hi Dave, thanks for the help.
I just came up with this:
Dim r As Integer
Dim c As Integer
r = Range(quot;BJ3quot;).Value
c = Range(quot;BJ4quot;).Value
Range(quot;C4quot;).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: www.excelforum.com/member.php...foamp;userid=6261
View this thread: www.excelforum.com/showthread...hreadid=515148
- Nov 03 Mon 2008 20:47
selection in VBA
close
全站熱搜
留言列表
發表留言
留言列表

