ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting a Range with a variable in the ordered pair (https://www.excelbanter.com/excel-programming/403955-selecting-range-variable-ordered-pair.html)

Paul Lambson

Selecting a Range with a variable in the ordered pair
 
Thanks in advance for the help.

I am building a macro and am trying to select a range where the first
variable is constant at CE3 but and the width is constant ranging to
CU but the lenght is the problem. I can't use CurrentRegion because
there isn't a blank border on the sides and there is one blank row
before the end of the data set. I have been trying to use a Vlookup
wosksheet function to select the right side of the ordered pair but am
unable to get it to work. Any ideas?
This is what i have gotten so far. It doesn't work at all but hopfully
you get the idea.
Range ("CE2:CU3")
Offset(0, 1).Formula = "=VLOOKUP(Total,A2:ER500,99)"
Selection.Cut
Range("AH22").Select
ActiveSheet.Paste
End Sub

Otto Moehrbach

Selecting a Range with a variable in the ordered pair
 
Ordered pair?
State what you want to select. You say that there is a blank row above the
last row of data. Do you want to select CE3 to CU3 and down to the last row
of data on the sheet? Assuming that's what you want to do and assuming that
Column CE is occupied in the last row, maybe something like this is what you
want:
Range("CE3", Range("CE" & Rows.Count).End(xlUp).Offset(, 16)).Select
HTH Otto
"Paul Lambson" wrote in message
...
Thanks in advance for the help.

I am building a macro and am trying to select a range where the first
variable is constant at CE3 but and the width is constant ranging to
CU but the lenght is the problem. I can't use CurrentRegion because
there isn't a blank border on the sides and there is one blank row
before the end of the data set. I have been trying to use a Vlookup
wosksheet function to select the right side of the ordered pair but am
unable to get it to work. Any ideas?
This is what i have gotten so far. It doesn't work at all but hopfully
you get the idea.
Range ("CE2:CU3")
Offset(0, 1).Formula = "=VLOOKUP(Total,A2:ER500,99)"
Selection.Cut
Range("AH22").Select
ActiveSheet.Paste
End Sub




Paul Lambson

Selecting a Range with a variable in the ordered pair
 
On Jan 9, 5:07*pm, "Otto Moehrbach" wrote:
Orderedpair?
State what you want to select. *You say that there is a blank row above the
last row of data. *Do you want to select CE3 to CU3 and down to the last row
of data on the sheet? *Assuming that's what you want to do and assuming that
Column CE is occupied in the last row, maybe something like this is what you
want:
Range("CE3", Range("CE" & Rows.Count).End(xlUp).Offset(, 16)).Select
HTH *Otto"Paul Lambson" wrote in message

...



Thanks in advance for the help.


I am building a macro and am trying to select a range where the first
variable is constant at CE3 but and the width is constant ranging to
CU but the lenght is the problem. I can't use CurrentRegion because
there isn't a blank border on the sides and there is one blank row
before the end of the data set. I have been trying to use a Vlookup
wosksheet function to select the right side of theorderedpairbut am
unable to get it to work. Any ideas?
This is what i have gotten so far. It doesn't work at all but hopfully
you get the idea.
* *Range ("CE2:CU3")
* *Offset(0, 1).Formula = "=VLOOKUP(Total,A2:ER500,99)"
* *Selection.Cut
* *Range("AH22").Select
* *ActiveSheet.Paste
End Sub- Hide quoted text -


- Show quoted text -


Otto, worked like a dream thanks MUCH!


All times are GMT +1. The time now is 05:29 PM.

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