+ Reply to Thread
Results 1 to 3 of 3

multiple loops in one macro

  1. #1
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    multiple loops in one macro

    Hi

    Can anyone tell me whether it is posisble to have multiple loops looping the same cell range but looking for different things in one macro?

    So far i have one loop which loops thought the cell range F4:U644 and checks to see if the cell is empty and if it has text it copies that text value and pastes it into another sheet.

    Please Login or Register  to view this content.
    But can you ahve the same loop duplicated in the same macro so it loops through the same cell range but checks for four other things.

    In one loop I need it to check the cell formatting and then choice on the four options:
    • if it is a percentage and has no decimal place then in the Sheets ("Input_Reference_Table") column 10 the value %10.0%%
    • if it is a percentage and has a decimal place then in the Sheets ("Input_Reference_Table") column 10 the value %10.(put number of decimal places here)%%
    • If it is a number and has no decimal places then in the Sheets ("Input_Reference_Table") column 10 the value %10.0%
    • If it is a number and has a decimal places then in the Sheets ("Input_Reference_Table") column 10 the value %10.(put number of decimal places here)%

    In second loop I need it to check the cell colour and if it is grey then in the Sheets("Input_Reference_Table") column 13 the value False

    In third loop I need it to check the cell colour and if it is yellow then in the Sheets("Input_Reference_Table") column 14 the value False

    In forth loop I need it to check the column number and then in the Sheets("Input_Reference_Table") column 14 the value should be going from 1 to 16 put the column number (e.g. if it its column F its 1 and if its column U its 16)

    Can anyone help me? i knows what i am asking is probably really confusing but any help would be appricated.

    Thanks

    Jeskit
    Last edited by jeskit; 04-28-2011 at 07:00 AM.

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: multiple loops in one macro

    Quote Originally Posted by jeskit View Post
    Hi

    Can anyone tell me whether it is posisble to have multiple loops looping the same cell range but looking for different things in one macro?

    So far i have one loop which loops thought the cell range F4:U644 and checks to see if the cell is empty and if it has text it copies that text value and pastes it into another sheet.

    Please Login or Register  to view this content.
    But can you ahve the same loop duplicated in the same macro so it loops through the same cell range but checks for four other things.

    In one loop I need it to check the cell formatting and then choice on the four options:
    • if it is a percentage and has no decimal place then in the Sheets ("Input_Reference_Table") column 10 the value %10.0%%
    • if it is a percentage and has a decimal place then in the Sheets ("Input_Reference_Table") column 10 the value %10.(put number of decimal places here)%%
    • If it is a number and has no decimal places then in the Sheets ("Input_Reference_Table") column 10 the value %10.0%
    • If it is a number and has a decimal places then in the Sheets ("Input_Reference_Table") column 10 the value %10.(put number of decimal places here)%

    In second loop I need it to check the cell colour and if it is grey then in the Sheets("Input_Reference_Table") column 13 the value False

    In third loop I need it to check the cell colour and if it is yellow then in the Sheets("Input_Reference_Table") column 14 the value False

    In forth loop I need it to check the column number and then in the Sheets("Input_Reference_Table") column 14 the value should be going from 1 to 16 put the column number (e.g. if it its column F its 1 and if its column U its 16)

    Can anyone help me? i knows what i am asking is probably really confusing but any help would be appricated.

    Thanks

    Jeskit
    Hi Jeskit,

    Can you post an example workbook?

    Thank You, Mike

  3. #3
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: multiple loops in one macro

    hI

    Dpends which workbook? i ahve one workbook which contains the macro and one which is the template. Because the macro opens the template and loops through the cell range within it.

+ 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