+ Reply to Thread
Results 1 to 3 of 3

How to do a For Each and break up the range?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    How to do a For Each and break up the range?

    How would I specify the range for a "For Each cell in range" command if the ranges is fragmented.


    In plain text I want it to do:


    For each cell in range G2:G300 and range (user selected column1) : (user selected column1) and range (user selected column2) : (user selected column2), etc.....


    Is this possible? If so what is the proper syntax?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How to do a For Each and break up the range?

      For Each rArea In rInput.Areas
        For Each cell In rArea.Cells
          ...
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to do a For Each and break up the range?

    Maybe:

    Sub ks100yy()
    Dim rcell As Long, x As String, y As String
    x = InputBox("Please select Column Letter 1")
    y = InputBox("Please select Column Letter 2")
    
    With Range("G2:G200, " & x & "2:" & x & "200" & ", " & y & "2:" & y & "200")
        ' DO SOMETHING
    End With
    
    End Sub

+ 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] Named Range seems to break Formulas
    By Moggeth in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-13-2015, 12:22 AM
  2. VBA to insert page break after range not in the middle of it
    By lonemascot in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2015, 12:24 PM
  3. Return a cell value in a date range break
    By Kicassrt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2013, 02:49 PM
  4. [Solved] Subscript out of range error, but break mode not available.
    By caddcop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2012, 11:24 AM
  5. Break long range into 2 code lines
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-13-2011, 01:50 PM
  6. How do I break a date range by month?
    By HeatherDawn in forum Excel General
    Replies: 2
    Last Post: 09-01-2005, 03:05 PM
  7. [SOLVED] How to break scale when numbers are wide range?
    By Rachel in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 07-13-2005, 02:05 PM

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