Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default unresolved post: Add in and the worksheetselectionchange interacti

Hi, I posted the following question and remained unresolved:
On Thu, 22 Jan 2009 06:45:01 -0800, filo666

I made an Add In with a Workbook_SheetSelectionChange macro
so that the user of my add in will run the macro when he changes the cell
selection. The problem is that sience the add in work book is not
selection-changed, therefore the macro is not executed; how to tell VB that
the macro in the add in applies to all the open workbooks
(Workbook_SheetSelectionChange)?

"Gord Dibben" wrote:

Place this in your add-in Thisworkbook module

Private WithEvents XLApp As Excel.Application
Private Sub Workbook_Open()
Set XLApp = Excel.Application
End Sub
Private Sub XLApp_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
MsgBox "hello"
End Sub


THE PROBLEM:

when I try to get:
rw = ActiveWorkbook.ActiveSheet.Cells.Find(What:="*",
After:=ActiveSheet.Range("A1"), Lookat:=xlPart, LookIn:=xlFormulas, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row
I get an error: Run-time error 91.

any help will be appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default unresolved post: Add in and the worksheetselectionchange interacti

I get an error: Run-time error 91.

This is the error when nothing is found. As you are looking for the
wildcard, I assume that you will get the error on an empty worksheet. Try the
following:-

Dim rngFind
Dim rw

Set rngFind = ActiveWorkbook.ActiveSheet.Cells.Find(What:="*", _
After:=ActiveSheet.Range("A1"), LookAt:=xlPart, LookIn:=xlFormulas, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False)

If Not rngFind Is Nothing Then
rw = rngFind.Row
End If

--
Regards,

OssieMac


"filo666" wrote:

Hi, I posted the following question and remained unresolved:
On Thu, 22 Jan 2009 06:45:01 -0800, filo666

I made an Add In with a Workbook_SheetSelectionChange macro
so that the user of my add in will run the macro when he changes the cell
selection. The problem is that sience the add in work book is not
selection-changed, therefore the macro is not executed; how to tell VB that
the macro in the add in applies to all the open workbooks
(Workbook_SheetSelectionChange)?

"Gord Dibben" wrote:

Place this in your add-in Thisworkbook module

Private WithEvents XLApp As Excel.Application
Private Sub Workbook_Open()
Set XLApp = Excel.Application
End Sub
Private Sub XLApp_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
MsgBox "hello"
End Sub


THE PROBLEM:

when I try to get:
rw = ActiveWorkbook.ActiveSheet.Cells.Find(What:="*",
After:=ActiveSheet.Range("A1"), Lookat:=xlPart, LookIn:=xlFormulas, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row
I get an error: Run-time error 91.

any help will be appreciated

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofilter problem unresolved Jamie R[_2_] Excel Discussion (Misc queries) 4 December 3rd 08 08:59 PM
worksheetselectionchange function to run macro [email protected] Setting up and Configuration of Excel 2 November 26th 06 09:55 AM
Why is Excel so bad at dealing with user forms ? isn't this a major unresolved flaw ? Richard Finnigan Excel Programming 4 February 16th 06 07:21 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM
Unresolved local named range Andre Louw Excel Programming 3 October 28th 04 06:20 AM


All times are GMT +1. The time now is 12:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"