ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select Range found by Vlookup (https://www.excelbanter.com/excel-programming/359151-select-range-found-vlookup.html)

JG Scott

Select Range found by Vlookup
 
I have a vlookup formula in a spreadsheet that returns a range name,
either "Top" or "Bottom". (These are defined ranges in the
spreadsheet.) I would like to write VBA to select the range returned
by this vlookup.

Thank you.


Chip Pearson

Select Range found by Vlookup
 
Try something along the lines of


Dim S As Variant
On Error Resume Next
S = Application.VLookup(Range("A1"), Range("B1:C2"), 2, False)
If IsError(S) = False Then
Range(S).Select
Else
' not found
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"JG Scott" wrote in message
oups.com...
I have a vlookup formula in a spreadsheet that returns a range
name,
either "Top" or "Bottom". (These are defined ranges in the
spreadsheet.) I would like to write VBA to select the range
returned
by this vlookup.

Thank you.





All times are GMT +1. The time now is 11:07 PM.

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