+ Reply to Thread
Results 1 to 5 of 5

Enter Variable Text into Cell

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    Lexington, KY
    MS-Off Ver
    Excel 2010
    Posts
    21

    Enter Variable Text into Cell

    I new to VBA and am forced to copy code I find on forums. The below code works, but I don't want a msgbox. I want each sItem.name that is selected to be entered into a range of cells.

    I am sure this is easy, but I can't figure it out.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,570

    Re: Enter Variable Text into Cell

    Don't know how you are selecting the cell but it will look something like:
    Range("A1").Value=sItem.Name
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-26-2013
    Location
    Lexington, KY
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Enter Variable Text into Cell

    I tried doing that, but it isn't working properly.

    Let's say I want the macro to enter each sItem.Name in a different cell in the range (A80:A120). I tried the following code, but it is inputting the same name in each cell. What I am wanting is for the macro to list every item that I have selected in the slicer. So if I selected Sales and Interest, I would want A80 to say Sales and A81 to say Interest, with A82:A120 being blank.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,570

    Re: Enter Variable Text into Cell

    Try the mod below. I can't test it since I use XL2007
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-26-2013
    Location
    Lexington, KY
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Enter Variable Text into Cell

    That works perfectly! Thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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