runtime Error '424' using Application.Selection

M

malpropio

Hi everyone,
I have that piece of code to set the focus of a userform to a certain
sheet and cell but problem is I keep on getting a runtime error '424'

Dim selRange As Range
Set selRange = Application.Selection
'ecDisplayLocationRE.Text = "'" & selRange.Worksheet.Name & "'!" &
selRange.Address
bpDisplayLocationRE.Text = "'" & selRange.Worksheet.Name & "'!" &
selRange.Address
'ecDisplayLocation.SetFocus
bpDisplayLocation.SetFocus


Thks for the help
 
G

Gary Brown

Without having tested it, I would say, try...
bpDisplayLocationRE.Text = "'" & selRange.Parent.Name & "'!" &
selRange.Address
instead of...
bpDisplayLocationRE.Text = "'" & selRange.Worksheet.Name & "'!" &
selRange.Address

--
HTH,
Gary Brown
(e-mail address removed)
If this post was helpful to you, please select ''YES'' at the bottom of the
post.
 
M

malpropio

Same result, still getting th Runtime Error.


Without having tested it, I would say, try...
bpDisplayLocationRE.Text = "'" & selRange.Parent.Name & "'!" &
selRange.Address
instead of...
bpDisplayLocationRE.Text = "'" & selRange.Worksheet.Name & "'!" &
selRange.Address

--
HTH,
Gary Brown
(e-mail address removed)
If this post was helpful to you, please select ''YES'' at the bottom of the
post.
 
G

Gary Brown

I'm assuming 'bpDisplayLocationRE' is a text box.
What is 'bpDisplayLocation'?

--
HTH,
Gary Brown
(e-mail address removed)
If this post was helpful to you, please select ''YES'' at the bottom of the
post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top