ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting a variable row range (https://www.excelbanter.com/excel-programming/324633-selecting-variable-row-range.html)

dan

selecting a variable row range
 
I have the following code working to select my fixed
source and destination ranges. How do I change my fixed
sourceRange to a variable sourceRange. Currently the
sourceRange is fixed .Range(K3:M3), this is date data, but
I could have 1 date in K3 only or dates from K3 to IV3.
How do I select this variable range?

Dim sourceRange As Range, destRange As Range
Dim Lr As Long

Lr= LastRow(Sheets("S1"))+1
Set sourceRange = Sheets("S1").Range("K3:M3")

I already setup my LastRow and LastColumn FUNCTIONs to
support Lr. Thanks goes to Ron de Bruin and his website
for coding help. Thanks for the help.



gocush[_29_]

selecting a variable row range
 
See my reply to your other post

"Dan" wrote:

I have the following code working to select my fixed
source and destination ranges. How do I change my fixed
sourceRange to a variable sourceRange. Currently the
sourceRange is fixed .Range(K3:M3), this is date data, but
I could have 1 date in K3 only or dates from K3 to IV3.
How do I select this variable range?

Dim sourceRange As Range, destRange As Range
Dim Lr As Long

Lr= LastRow(Sheets("S1"))+1
Set sourceRange = Sheets("S1").Range("K3:M3")

I already setup my LastRow and LastColumn FUNCTIONs to
support Lr. Thanks goes to Ron de Bruin and his website
for coding help. Thanks for the help.




Bob Phillips[_6_]

selecting a variable row range
 

Set sourceRange = Sheets("S1").Range(Range("K3"),Cells(LastRow,LastC ol))

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dan" wrote in message
...
I have the following code working to select my fixed
source and destination ranges. How do I change my fixed
sourceRange to a variable sourceRange. Currently the
sourceRange is fixed .Range(K3:M3), this is date data, but
I could have 1 date in K3 only or dates from K3 to IV3.
How do I select this variable range?

Dim sourceRange As Range, destRange As Range
Dim Lr As Long

Lr= LastRow(Sheets("S1"))+1
Set sourceRange = Sheets("S1").Range("K3:M3")

I already setup my LastRow and LastColumn FUNCTIONs to
support Lr. Thanks goes to Ron de Bruin and his website
for coding help. Thanks for the help.






All times are GMT +1. The time now is 01:54 PM.

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