Consulting

Results 1 to 4 of 4

Thread: How to adjust the size of the `Note` after opening it?

  1. #1

    Post How to adjust the size of the `Note` after opening it?

    So here is macro:

    Private Sub NoteZoom3()
    With ActiveWindow.VisibleRange
    NoteChangeSize .Width, .Height, True
    End With
    End Sub

    Private Sub NoteChangeSize(w!, h!, Optional scr As Boolean)
    With ActiveCell.Comment.Shape
    .Width = w: .Height = h
    If scr Then .Top = 0: .Left = 0: .Visible = msoTrue
    End With
    End Sub

    How it works... go to the cell that contains `Note` > Run the macro!
    `Note` is adjusted to the size Of the sheet window (we get <Full Screen>).
    It's all bad if we for example are somewhere in the column (AB) or line 60. `Note` that opens in <Full Screen> but it is fixed in the top where the cell (A) and I need to scroll up to see.

    I would like to be adjusted to the size of the Sheet and opened exactly where the `Note` (that each time not to climb up).

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    Not everything is clear to me, but more or less something like this:
    Private Sub NoteChangeSize(w As Single, h As Single, Optional scr As Boolean)  Dim rngVR As Range
        
        With ActiveCell
          'Set the active cell in the upper left corner of the sheet
          ActiveWindow.ScrollColumn = .Column
          ActiveWindow.ScrollRow = .Row
          
          With .Comment.Shape
            .Width = w: .Height = h
            
            If scr Then
              Set rngVR = ActiveWindow.VisibleRange
              
              .Top = rngVR.Top: .Left = rngVR.Left
            End If
            
            .Visible = msoTrue
          End With
          
        End With
    End Sub
    Artik

  3. #3

    Arrow Code prettified.

    Hi Artik !

    Thank you Sr.
    But no need scroll - Just open <Full Screen>.
    I little bit correct the code. Now it's look better:

    Private Sub NoteChangeSize(w!, h!, Optional scr As Boolean)
        With ActiveCell.Comment.Shape
             .Width = w: .Height = h
             If scr Then .Top = ActiveWindow.VisibleRange.Top: .Left = ActiveWindow.VisibleRange.Left: .Visible = msoTrue
        End With
    End Sub

    Last edited by rediffusion; 08-08-2019 at 12:15 AM. Reason: Added code brackets.

  4. #4

    Arrow Here's another option a little simplistic:

    Private Sub NoteZoom3()
    With ActiveWindow.VisibleRange
    NoteChangeSize .Width, .Height, True
    End With
    End Sub

    Private Sub NoteChangeSize(w!, h!, Optional t! Optional l! Optional scr AsBoolean)
    With ActiveCell.Comment.Shape
    .Width = w: .Height = h
    If scr Then .Top = 0: .Left = 0: .Visible = msoTrue
    End With
    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •