+ Reply to Thread
Results 1 to 5 of 5

I'm confused this loop works?

  1. #1
    Registered User
    Join Date
    10-12-2019
    Location
    Bangkok, Thailand
    MS-Off Ver
    2007
    Posts
    1

    I'm confused this loop works?

    Please Login or Register  to view this content.

    I'm a bit confused on how this loop actually works......
    L1. I know that it declares aCell as a range variable and QuickText as a string variable.
    L2. Not sure if the for-loop works like the python....Evoke something from Sheet1.Range("F2:G2").Cells into variable aCell...... I'm lost for Sheet1.Range("F2:G2").Cells ( What it actually contains "Value" or "Position") .
    L3. Concatenation between two variables....

    My question is what is heet1.Range("F2:G2").Cells?
    Last edited by TestKing1994; 10-12-2019 at 08:52 AM. Reason: Code Formatting

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: I'm confused this loop works?

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    As looping is useless here, just use the & operator to concatenate two values or two variables, whatever …

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: I'm confused this loop works?

    You started your loop by saying:

    Please Login or Register  to view this content.
    This seems to do the same

    Please Login or Register  to view this content.

    So your macro will perform the same tasks for all the cells in your range

    Horizontally then Vertically in your case You had two cells F2 and G2

    You ended your loop using

    Please Login or Register  to view this content.

    Run this code as a test

    Please Login or Register  to view this content.

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

    Re: I'm confused this loop works?

    Ensure the "Immediate window" is open in your VBE.
    run this mod:
    Please Login or Register  to view this content.
    Ben Van Johnson

+ 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. Confused with Loop to Force internet connection
    By margal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2016, 09:35 AM
  2. [SOLVED] For Each Loop Works for Textboxes but Not for DTPickers.... why?
    By TheScott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2015, 06:01 AM
  3. Replies: 1
    Last Post: 10-03-2012, 10:32 PM
  4. [SOLVED] Macro executes but not giving results :confused::confused::confused:
    By Ganesh7299 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2012, 10:49 AM
  5. loop works for one but causes error for other data
    By gill389 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2011, 08:21 AM
  6. With Loop + Find Method = Confused
    By hurricanopotamus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2010, 04:15 PM

Tags for this Thread

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