Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help!!! i can not send target to my sub in event

i dim a sub named test(r as range)
And I call this sub in the worksheet_selectionchange event as below
But the VB stop it with error messege .said , it need a object
how can i solve it?
pls help me
the program is below:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
test(activework.sheets("sheet1").range("A1:B2"))
'this sentense work
test (Target)
'this sentense doesnt work
End Sub

Sub test(r As Range)
MsgBox "OK"
End Sub

help would be appreciate

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default help!!! i can not send target to my sub in event

You don't need the brackets, unless you're using the Call statement.

Also, it's ActiveWorkbook, not ActiveWork

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
test ActiveWorkbook.Sheets("sheet1").Range("A1:B2")
test Target
End Sub

Sub test(r As Range)
MsgBox "OK"
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"benbenben " wrote in message
...
i dim a sub named test(r as range)
And I call this sub in the worksheet_selectionchange event as below
But the VB stop it with error messege .said , it need a object
how can i solve it?
pls help me
the program is below:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
test(activework.sheets("sheet1").range("A1:B2"))
'this sentense work
test (Target)
'this sentense doesnt work
End Sub

Sub test(r As Range)
MsgBox "OK"
End Sub

help would be appreciated


---
Message posted from http://www.ExcelForum.com/



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
Bypass: A program is trying to send mail using Item.Send prompt Vick Excel Discussion (Misc queries) 1 June 25th 09 03:31 AM
Target cell reference moves when target is cut and pasted Illya Teideman Excel Discussion (Misc queries) 5 May 31st 07 11:34 AM
My send to in excel/word does not offer send as attachment Mstink Excel Discussion (Misc queries) 11 March 16th 06 02:49 PM
Error with Target.Name.Name in Worksheet_Change event SuperJas Excel Programming 2 January 8th 04 03:26 AM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 12:01 PM.

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

About Us

"It's about Microsoft Excel"