+ Reply to Thread
Results 1 to 9 of 9

Using the result of ADDRESS() function as a range for VBA function

Hybrid View

  1. #1
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Using the result of ADDRESS() function as a range for VBA function

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    Sub GetComment()
    Dim r As Range
    
    Application.ScreenUpdating = False
    
    For Each r In Range("C2:C" & Range("C" & Rows.Count).End(xlUp).Row).Cells
        If Not Range(r.Value).Comment Is Nothing Then
            With r.Offset(, 1)
                .ClearComments
                .AddComment (Range(r.Value).Comment.Text)
                .Comment.Visible = False
            End With
        End If
    Next r
    
    Application.ScreenUpdating = True
    
    End Sub
    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  2. #2
    Registered User
    Join Date
    01-08-2016
    Location
    Poland
    MS-Off Ver
    2010, Office 365
    Posts
    14

    Re: Using the result of ADDRESS() function as a range for VBA function

    Thanks! It works great!

    Right before I have seen your answer I did something like this:
    Sub copy_commment()
    
    Rws = Selection.Rows.Count
    N = 0
    
    Do While N < Rws
     Range(ActiveCell.Offset(0, -1).Value).Copy
     ActiveCell.PasteSpecial xlPasteComments
     ActiveCell.Offset(1, 0).Select
     N = N + 1
    Loop
    
    End Sub
    But your solution seems better as it works faster (it is not switching the active cell). I'm only an ocassional VBA user, so every time I want to do something using VBA I have to learn most things anew
    Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Replacing cell address in a formula with the result of ADDRESS function
    By CMG2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-25-2014, 02:59 AM
  2. [SOLVED] Using function result as cell address
    By El_engineer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-19-2013, 08:19 AM
  3. Move to the result of the address function
    By Wigglebritches in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2013, 12:37 AM
  4. [SOLVED] Using the result of a CELL "address" function in another function
    By jphalverson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-21-2013, 11:36 AM
  5. How do you use ADDRESS function result in a macro as a paste destination
    By phanjoe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2012, 01:10 PM
  6. Convert ADDRESS() function result to literal text
    By ajetrumpet in forum Excel General
    Replies: 6
    Last Post: 03-18-2011, 04:20 PM
  7. Using address function result in an array
    By RLR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2006, 10:25 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1