Show input box with cell value

  • Thread starter Thread starter sunilkes
  • Start date Start date
S

sunilkes

Hi

I have a spreadsheet with some text in it, and I do not want to
increase the cell size to display it. Is there a way I can write a
macro to display the cell value on an input box (like in data
validation), when there is focus on the cell?

I have been able to do this for only one cell, but it has a range
reference to it - how do i refer to the cells own value, to display it
on the input box?


Thanks
 
Paste this code into your worksheet module,it will create a comment box
with A1 text,
So whenever you focus on A1 the comment box will pop up showing you
what is in it


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").ClearComments

Range("A1").AddComment
Range("A1").Comment.Visible = False
Range("A1").Comment.Text Text:=Range("A1").Text

End Sub
 
Thanks,

Is there a way I can do this for multiple cells in one go?

I have a column of say - a 100 items I want this done for...

Sunil
 
This will add comments to cells A1 to A100

Sub AddComment()
Dim i As Integer
For i = 1 To 100
With Cells(i, 1)
.ClearContents
.AddComment
.Comment.Visible = False
.Comment.Text Text:=Cells(i, 1).Text
End With
End Sub


Sandy
 
This will add comments to cells A1 to A100

Sub AddComment()
Dim i As Integer
For i = 1 To 100
With Cells(i, 1)
.ClearComments
.AddComment
.Comment.Visible = False
.Comment.Text Text:=Cells(i, 1).Text
End With
End Sub


Sandy
 

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

Back
Top