+ Reply to Thread
Results 1 to 3 of 3

Looping until an empty cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-28-2009
    Location
    Chicago, Il
    MS-Off Ver
    Excel 2007
    Posts
    67

    Looping until an empty cell

    Hello
    I have a macro in which i am taking information from one cell and puting it in to a text box but need to repeat this process from B1 to C1 to D1 etc here is what I have so far

    Dim shpTextBox As Shape
            
    Set shpTextBox = Sheet3.Shapes("Text Box 1")
    shpTextBox.TextFrame.Characters.Text = Sheet2.Range("B1").Value
     
    End Sub
    Last edited by Ricardo9211; 08-09-2009 at 05:17 PM.

  2. #2
    Forum Contributor
    Join Date
    06-14-2008
    Posts
    153

    Re: Looping until an empty cell

    Hi,

    Try this:

    Dim myRange As Range
    Set myRange = Sheet2.Range("A1:D1") ' specify your range here
    Set shpTextBox = Sheet3.Shapes("Text Box 1")
    
    ' ------- Loop ------
    For Each cell In myRange
     shpTextBox.TextFrame.Characters.Text = cell.Value 
    Next cell
    '----------- end loop ---------
    You may have to modify the line inside the loop. The way I see it now is that the last value will overwrite the previous one!

    Regards.
    Last edited by se1429; 08-09-2009 at 01:06 AM.
    Welcome to: http://www.exceldigest.com/myblog/
    "Excel help for the rest of us"

  3. #3
    Registered User
    Join Date
    07-28-2009
    Location
    Chicago, Il
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Looping until an empty cell

    Thank you very 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