selection in VBA

P

pinmaster

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
 
D

Dave Peterson

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

pinmaster

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
 
Top