Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Hover-over Function

Is it possible to have subroutine or function that will display the
"=weekday()" of a given date displayed in a message box if the contents of
that cell represents a date?

Ideally I'd like a "hover-over" function that would display the "=weekday()"
of the cell being hovered-over, but ......

Thanks in advance,
Raul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Hover-over Function

This will use the cell comment to display the week day. The comment is
mouse-over by default.
Put this code in the worksheet code module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wkday As String
Dim comm As Comment
If IsDate(Target) Then
wkday = Weekday(Target)
If ActiveSheet.Comments.Count 0 Then
For Each comm In ActiveSheet.Comments
If comm.Parent.Address = Target.Address Then
Target.Comment.Delete
End If
Next
End If
Target.AddComment "Weekday = " & wkday
End If
End Sub

Mike F
"Raul" wrote in message
...
Is it possible to have subroutine or function that will display the
"=weekday()" of a given date displayed in a message box if the contents of
that cell represents a date?

Ideally I'd like a "hover-over" function that would display the
"=weekday()"
of the cell being hovered-over, but ......

Thanks in advance,
Raul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Hover-over Function

Mike,
Thanks for your response. I've inserted a module in the workbook I'm
working with and copied your code to this new modue. How do I pass the
"Target" range to this subroutine?

Thanks,
Raul

"Mike Fogleman" wrote:

This will use the cell comment to display the week day. The comment is
mouse-over by default.
Put this code in the worksheet code module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wkday As String
Dim comm As Comment
If IsDate(Target) Then
wkday = Weekday(Target)
If ActiveSheet.Comments.Count 0 Then
For Each comm In ActiveSheet.Comments
If comm.Parent.Address = Target.Address Then
Target.Comment.Delete
End If
Next
End If
Target.AddComment "Weekday = " & wkday
End If
End Sub

Mike F
"Raul" wrote in message
...
Is it possible to have subroutine or function that will display the
"=weekday()" of a given date displayed in a message box if the contents of
that cell represents a date?

Ideally I'd like a "hover-over" function that would display the
"=weekday()"
of the cell being hovered-over, but ......

Thanks in advance,
Raul




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Hover-over Function

Mike,
Disregard my previous message. I inserted your code in the worksheet code
module (as you instructed) and it worked like a charm.

Thanks a bunch,
Raul

"Raul" wrote:

Mike,
Thanks for your response. I've inserted a module in the workbook I'm
working with and copied your code to this new modue. How do I pass the
"Target" range to this subroutine?

Thanks,
Raul

"Mike Fogleman" wrote:

This will use the cell comment to display the week day. The comment is
mouse-over by default.
Put this code in the worksheet code module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wkday As String
Dim comm As Comment
If IsDate(Target) Then
wkday = Weekday(Target)
If ActiveSheet.Comments.Count 0 Then
For Each comm In ActiveSheet.Comments
If comm.Parent.Address = Target.Address Then
Target.Comment.Delete
End If
Next
End If
Target.AddComment "Weekday = " & wkday
End If
End Sub

Mike F
"Raul" wrote in message
...
Is it possible to have subroutine or function that will display the
"=weekday()" of a given date displayed in a message box if the contents of
that cell represents a date?

Ideally I'd like a "hover-over" function that would display the
"=weekday()"
of the cell being hovered-over, but ......

Thanks in advance,
Raul




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
Making rows 'hover'? Martin Damgaard Excel Discussion (Misc queries) 1 April 24th 08 04:57 PM
Hover values in chart Midas Charts and Charting in Excel 1 February 8th 08 02:09 PM
a button that will hover Ben Excel Programming 3 July 13th 06 05:09 PM
Hover change Voodoodan Excel Discussion (Misc queries) 4 May 5th 06 01:32 PM
Hover over variable? HotRod Excel Programming 2 May 5th 05 09:18 PM


All times are GMT +1. The time now is 04:45 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"