ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Show input box with cell value (https://www.excelbanter.com/excel-worksheet-functions/116873-show-input-box-cell-value.html)

[email protected]

Show input box with cell value
 
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


curlydave

Show input box with cell value
 
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


[email protected]

Show input box with cell value
 
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


Sandy

Show input box with cell value
 
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

wrote:
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



Sandy

Show input box with cell value
 
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

wrote:
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




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com