Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Adjusting comment box size by Macro

Hi all
How to adjust comment box size and the font of the comment by macro? The
following is the macro.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wsCmt As Worksheet
Dim strCmt As String
Dim rngCmt As Range
Dim ar As Integer

Set wsCmt = Worksheets("rcpt")
Set rngCmt = wsCmt.Range("ndata")
ar = ActiveCell.Row

' Clear Comments
On Error Resume Next
Selection.SpecialCells(xlCellTypeComments).ClearCo mments

' Extracting the comment value
On Error GoTo endit
Select Case Val(ActiveCell.Column)
Case 2: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 2, 0)
GoTo feedisplay
Case 9: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 8, 0)
GoTo feedisplay
Case 10: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 9, 0)
GoTo feedisplay
Case 11: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 10, 0)
GoTo feedisplay
Case 12: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 11, 0)
GoTo feedisplay
Case 13: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 12, 0)
GoTo feedisplay
Case 14: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 13, 0)
GoTo feedisplay
Case 15: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 14, 0)
GoTo feedisplay

Case Else: Exit Sub
End Select
' Display fee balances in comments
feedisplay:
ActiveCell.AddComment CStr(strCmt)
ActiveCell.Comment.Visible = True

Exit Sub
endit:

End Sub


Thanks in advance.
With regards
Sreedhar
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default Adjusting comment box size by Macro

Hi

take a look at code written by Debra Dalgleish and Dave Peterson at
http://www.contextures.com/xlcomments03.html#Resize

--
Regards
Roger Govier

"yshridhar" wrote in message
...
Hi all
How to adjust comment box size and the font of the comment by macro? The
following is the macro.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wsCmt As Worksheet
Dim strCmt As String
Dim rngCmt As Range
Dim ar As Integer

Set wsCmt = Worksheets("rcpt")
Set rngCmt = wsCmt.Range("ndata")
ar = ActiveCell.Row

' Clear Comments
On Error Resume Next
Selection.SpecialCells(xlCellTypeComments).ClearCo mments

' Extracting the comment value
On Error GoTo endit
Select Case Val(ActiveCell.Column)
Case 2: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 2, 0)
GoTo feedisplay
Case 9: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 8, 0)
GoTo feedisplay
Case 10: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 9, 0)
GoTo feedisplay
Case 11: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 10, 0)
GoTo feedisplay
Case 12: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 11, 0)
GoTo feedisplay
Case 13: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 12, 0)
GoTo feedisplay
Case 14: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 13, 0)
GoTo feedisplay
Case 15: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 14, 0)
GoTo feedisplay

Case Else: Exit Sub
End Select
' Display fee balances in comments
feedisplay:
ActiveCell.AddComment CStr(strCmt)
ActiveCell.Comment.Visible = True

Exit Sub
endit:

End Sub


Thanks in advance.
With regards
Sreedhar


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Adjusting comment box size by Macro

Thanks Roger. The article is very useful for me.
With regards
Sreedhar

"Roger Govier" wrote:

Hi

take a look at code written by Debra Dalgleish and Dave Peterson at
http://www.contextures.com/xlcomments03.html#Resize

--
Regards
Roger Govier

"yshridhar" wrote in message
...
Hi all
How to adjust comment box size and the font of the comment by macro? The
following is the macro.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wsCmt As Worksheet
Dim strCmt As String
Dim rngCmt As Range
Dim ar As Integer

Set wsCmt = Worksheets("rcpt")
Set rngCmt = wsCmt.Range("ndata")
ar = ActiveCell.Row

' Clear Comments
On Error Resume Next
Selection.SpecialCells(xlCellTypeComments).ClearCo mments

' Extracting the comment value
On Error GoTo endit
Select Case Val(ActiveCell.Column)
Case 2: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 2, 0)
GoTo feedisplay
Case 9: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 8, 0)
GoTo feedisplay
Case 10: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 9, 0)
GoTo feedisplay
Case 11: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 10, 0)
GoTo feedisplay
Case 12: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 11, 0)
GoTo feedisplay
Case 13: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 12, 0)
GoTo feedisplay
Case 14: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 13, 0)
GoTo feedisplay
Case 15: strCmt = Application.WorksheetFunction.VLookup(Range("b" &
ar), rngCmt, 14, 0)
GoTo feedisplay

Case Else: Exit Sub
End Select
' Display fee balances in comments
feedisplay:
ActiveCell.AddComment CStr(strCmt)
ActiveCell.Comment.Visible = True

Exit Sub
endit:

End Sub


Thanks in advance.
With regards
Sreedhar



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
Adjusting Macro M.A.Tyler Excel Discussion (Misc queries) 2 March 24th 07 06:07 PM
Comment box size JoeP Excel Discussion (Misc queries) 3 July 31st 06 07:21 PM
Macro / VBA adjusting variable columns PaulW Excel Discussion (Misc queries) 1 April 23rd 06 08:25 AM
How do I re-size a comment box using VBA? Pete at Sappi Fine Paper Excel Discussion (Misc queries) 2 March 31st 06 04:13 PM
adjusting cell size in spreadsheets [email protected] Excel Discussion (Misc queries) 5 December 21st 05 05:59 PM


All times are GMT +1. The time now is 11:43 AM.

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"