comments in a cell

S

Steve

HYCH,

Just a question?

is there any way of using some vba that will add coments to a cell and
have the comment box appear as it does if i add my own comments
manually, would like the comment hidden until the cell is selected and
then have it show up!

obviously i know this happens when you manually process comments, but
i would like the comment box to appear and display values that are in
another worksheet within the same workbook.

hope that makes sense.


Steve
 
D

Dave Peterson

Steve said:
HYCH,

Just a question?

is there any way of using some vba that will add coments to a cell and
have the comment box appear as it does if i add my own comments
manually, would like the comment hidden until the cell is selected and
then have it show up!

obviously i know this happens when you manually process comments, but
i would like the comment box to appear and display values that are in
another worksheet within the same workbook.

hope that makes sense.

Steve
 
D

Dave Peterson

I'm not sure I understand, but maybe this would work:

Option Explicit
Sub AddCommentTest()
With Worksheets("Sheet1")
If .Range("A1").Comment Is Nothing Then
'do nothing
Else
'delete existing comment
.Range("A1").Comment.Delete
End If
.Range("a1").AddComment Text:=Worksheets("Sheet2").Range("H1").Text
End With
End Sub

This would display what's in H1 of Sheet2 in A1 of Sheet1.
 
S

Steve

I'm not sure I understand, but maybe this would work:

Option Explicit
Sub AddCommentTest()
    With Worksheets("Sheet1")
        If .Range("A1").Comment Is Nothing Then
            'do nothing
        Else
            'delete existing comment
            .Range("A1").Comment.Delete
        End If
        .Range("a1").AddComment Text:=Worksheets("Sheet2").Range("H1").Text
    End With
End Sub

This would display what's in H1 of Sheet2 in A1 of Sheet1.











--

Dave Peterson- Hide quoted text -

- Show quoted text -

Sorry Dave,

did not think i had explained it properly, but will try again, am
looking to find out if there is a way of having a comment box or form
appear when your mouse hovers over a cell, example

i place mouse icon over cell a2 and a form appears that shows
information in another sheet, relevant to the information in the cell
i am hovering over, i can get a form to pull information, but not sure
if i can have form appear on a mouse rollover event,

thats kinda what i am hoping for, that the cell my mouse hovers over
uses a mouse roll over event to display a form or comment box!

hope that makes more sense


Steve
 
S

Steve

Sorry Dave,

did not think i had explained it properly, but will try again, am
looking to find out if there is a way of having a comment box or form
appear when your mouse hovers over a cell, example

i place mouse icon over cell a2 and a form appears that shows
information in another sheet, relevant to the information in the cell
i am hovering over, i can get a form to pull information, but not sure
if i can have form appear on a mouse rollover event,

thats kinda what i am hoping for, that the cell my mouse hovers over
uses a mouse roll over event to display a form or comment box!

hope that makes more sense

Steve- Hide quoted text -

- Show quoted text -

am also happy to work with an activecell.value bringing up the form,
but would like to have a timer running that will shut the form after
approx 30 secs code i have so far is


This is in the Worksheet code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("a1") = ActiveCell.Value
formvalue.Show
End Sub


this is what i am using in the form to capture the details i need

Private Sub UserForm_Initialize()
'day
Me.Label1.Caption = Worksheets("Sheet2").Range("a3").Value
Me.Label2.Caption = Worksheets("Sheet2").Range("a4").Value
Me.Label3.Caption = Worksheets("Sheet2").Range("a5").Value
Me.Label4.Caption = Worksheets("Sheet2").Range("a6").Value
Me.Label5.Caption = Worksheets("Sheet2").Range("a7").Value
Me.Label6.Caption = Worksheets("Sheet2").Range("a8").Value
Me.Label7.Caption = Worksheets("Sheet2").Range("a9").Value
'volumes
Me.Label9.Caption = Worksheets("Sheet2").Range("s3").Value
Me.Label10.Caption = Worksheets("Sheet2").Range("s4").Value
Me.Label11.Caption = Worksheets("Sheet2").Range("s5").Value
Me.Label12.Caption = Worksheets("Sheet2").Range("s6").Value
Me.Label13.Caption = Worksheets("Sheet2").Range("s7").Value
Me.Label14.Caption = Worksheets("Sheet2").Range("s8").Value
Me.Label15.Caption = Worksheets("Sheet2").Range("s9").Value

Me.Label16.Caption = Worksheets("Sheet2").Range("i3").Value
End Sub

these work fine, so if i could place a timer event into the form or
worksheet code, then this would suffice :)



Steve
 
D

Dave Peterson

In a general module:

Option Explicit
Sub DismissTheForm()
Unload FormValue
End Sub

And behind the worksheet:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'I don't understand what this is for.
'me.Range("a1") = target.cells(1).Value

'change the number of seconds to 30 (5 is nicer for testing)
Application.OnTime Now + TimeSerial(0, 0, 5), _
"'" & ThisWorkbook.Name & "'!dismisstheform"

FormValue.Show

End Sub
 
S

Steve

In a general module:

Option Explicit
Sub DismissTheForm()
    Unload FormValue
End Sub

And behind the worksheet:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    'I don't understand what this is for.
    'me.Range("a1") = target.cells(1).Value

    'change the number of seconds to 30 (5 is nicer for testing)
    Application.OnTime Now + TimeSerial(0, 0, 5), _
        "'" & ThisWorkbook.Name & "'!dismisstheform"

    FormValue.Show

End Sub













--

Dave Peterson- Hide quoted text -

- Show quoted text -

Thanks Dave, works fine :)



Steve
 

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