ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   runtime Error '424' using Application.Selection (https://www.excelbanter.com/excel-programming/385605-runtime-error-424-using-application-selection.html)

malpropio

runtime Error '424' using Application.Selection
 
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


Gary Brown

runtime Error '424' using Application.Selection
 
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

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"malpropio" wrote:

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



malpropio

runtime Error '424' using Application.Selection
 
Same result, still getting th Runtime Error.


On Mar 19, 2:26 pm, Gary Brown
wrote:
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

If this post was helpful to you, please select ''YES'' at the bottom of the
post.

"malpropio" wrote:
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




Gary Brown

runtime Error '424' using Application.Selection
 
I'm assuming 'bpDisplayLocationRE' is a text box.
What is 'bpDisplayLocation'?

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"malpropio" wrote:

Same result, still getting th Runtime Error.


On Mar 19, 2:26 pm, Gary Brown
wrote:
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

If this post was helpful to you, please select ''YES'' at the bottom of the
post.

"malpropio" wrote:
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





malpropio

runtime Error '424' using Application.Selection
 
No bpDisplayLocationRE is a RefEdit not a TextBox.



On Mar 19, 4:28 pm, Gary Brown
wrote:
I'm assuming 'bpDisplayLocationRE' is a text box.
What is 'bpDisplayLocation'?

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.

"malpropio" wrote:
Same result, still getting th Runtime Error.


On Mar 19, 2:26 pm, Gary Brown
wrote:
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

If this post was helpful to you, please select ''YES'' at the bottom of the
post.


"malpropio" wrote:
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





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

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