Object Required - My Brain is Obviously Not Working
Have the following code tied to a userform, with a refedit. Works fine,
except that I need to store the column number selected by the end user for future use and keep getting the 'object required' message on the "Set LookupValuesColumn = InputRange.Column" line below. Know this is simple but I'm just not getting it. Can someone please advise how to fix? Private Sub SelectVLookupLookupValueContinue_Click() Dim InputRange As Range Dim InputSheet As Worksheet Dim LookupValuesColumn As String Set InputRange = Range(VLookupLookupValueColumnRefEdit.Text) Set InputSheet = InputRange.Parent Set InputRange = Application.Intersect(InputRange, InputSheet.UsedRange) 'Store column number for future use Set LookupValuesColumn = InputRange.Column Unload Me End Sub |
Object Required - My Brain is Obviously Not Working
Thanks; did as you suggested and works like a charm!
"Gary''s Student" wrote: Drop the Set: LookupValuesColumn = InputRange.Column also: 1. consider Dim'ing LookupValuesColumn as Long 2. consider storing it in a cell or Dim'ing it in a static or public location. -- Gary''s Student - gsnu200857 "Paige" wrote: Have the following code tied to a userform, with a refedit. Works fine, except that I need to store the column number selected by the end user for future use and keep getting the 'object required' message on the "Set LookupValuesColumn = InputRange.Column" line below. Know this is simple but I'm just not getting it. Can someone please advise how to fix? Private Sub SelectVLookupLookupValueContinue_Click() Dim InputRange As Range Dim InputSheet As Worksheet Dim LookupValuesColumn As String Set InputRange = Range(VLookupLookupValueColumnRefEdit.Text) Set InputSheet = InputRange.Parent Set InputRange = Application.Intersect(InputRange, InputSheet.UsedRange) 'Store column number for future use Set LookupValuesColumn = InputRange.Column Unload Me End Sub |
All times are GMT +1. The time now is 05:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com