+ Reply to Thread
Results 1 to 8 of 8

How can i define below start range as range given in a cell to do a Loop ?? Please help

  1. #1
    Registered User
    Join Date
    07-12-2012
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2010
    Posts
    24

    How can i define below start range as range given in a cell to do a Loop ?? Please help

    How can i define below start range as range given in a cell to do a Loop ?? Please help

    Means range given in cell "B5" and "C5" in sheet 2 I want to use in below code

    So that I can loop like (For counter = startrng To endrng ) Is it possible?

    .Range("Q" & counter).Value

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    I'm not sure I fully understand... but sounds like you want the first cell and last cell of a range to be in those cells and then run a macro that checks each of the cells in that range? Maybe something like this:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    07-12-2012
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    Hi Arkadi,

    You got it right and Thank you so much for your help.

    Its working fine the only thing which I want to ask now how can I copy the range towards right to it from Actual Vs plan tab.
    as of now I am using like this

    If myCell.Value = Sheets("BurnMacro").Range("C3").Value Then
    Sheets("Actual vs Plan").Range("R16:V17").Copy Destination:=Sheets("BurnMacro").Range("B8")

    and will it Ignore the hidden rows in Actuals tab? (as I don't want to copy those)

    Thank you
    Akash

  4. #4
    Registered User
    Join Date
    07-12-2012
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    Hi Arkadi,

    I think I got it (Just copied your code from the above ), not completely as it is copying the hidden row as well which I don't want to copy any suggestion how can we copy only visible rows ??

    see the below code
    Please Login or Register  to view this content.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    Akash, well done although your code copies the whole range over and over this way... not just the row of one cell, so if one cell = C3 then it will copy all the range. Try

    Please Login or Register  to view this content.
    Last edited by Arkadi; 06-24-2015 at 01:32 PM.

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    This is probably 1. Easier to follow, and 2.more effective, also fixed the issue of pasting the values in the same destination each time (my bad)
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-12-2012
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    You are awesome. Thank you so much,

    Akash

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: How can i define below start range as range given in a cell to do a Loop ?? Please hel

    Happy to help akash, please mark the thread as solved if you are satisfied with the solution.

+ 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] Define Range based on another Range loop
    By SierraKilo78 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2015, 11:54 AM
  2. Define range to select from current cell in a full range (using worksheet_change)
    By draddy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2013, 11:48 AM
  3. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 PM
  4. [SOLVED] Using cell value to define a range (for a variable defined as a range)
    By Sccye in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-02-2012, 10:25 AM
  5. HOW CAN I DEFINE A RANGE IN LOOP
    By Didar. in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2005, 05:30 AM

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