+ Reply to Thread
Results 1 to 4 of 4

Using counter as cell reference

  1. #1
    Registered User
    Join Date
    02-01-2016
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    1

    Unhappy Using counter as cell reference

    Hi,

    I'm trying to run a program that goes down row by row, checks if two values are equal, and if not, replaces the second value with the first.

    I currently have a for loop set up as follows:

    Please Login or Register  to view this content.
    It checks the values correctly, but right now it just outputs the range A1:I1 5 times. I want it to output a range Ai:Ii, where i is the integer I'm using for my for loop.

    Is this possible?

    Thanks in advance for your help.
    Last edited by Richard Buttrey; 02-01-2016 at 04:59 PM.

  2. #2
    Forum Contributor
    Join Date
    03-10-2013
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Using counter as cell reference

    Hi, superevilangel


    On this basis, it will be good!

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using counter as cell reference

    Hi and welcome to the forum. Unfortunately your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    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, it also maintains VBA formatting.

    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

    Since this is your first post I'll add them for you but please remember for the future.

    Try changing
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    You may not of course need a loop. It's possible you could do this with regular functions and avoid VBA altogether.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Using counter as cell reference

    ...forgot to mention you don't need .Select which should generally be avoided since it's rarely necessary and just adds a time overhead.

    Please Login or Register  to view this content.
    And one more tip, try to avoid code like Worksheets("Sheet1") and use the VBA sheet code name. e.g
    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 02-01-2016 at 05:04 PM.

+ 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. Replies: 8
    Last Post: 12-27-2013, 12:27 PM
  2. Counter to add 1 to another file's cell based on third cell's date.
    By slowery82 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2013, 08:11 AM
  3. Creating a Cell reference counter
    By CG_Will in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-10-2012, 09:22 AM
  4. [SOLVED] Locating Duplicate Cell Data with a Cell Counter and Highlight
    By garrett.grillo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2012, 01:46 AM
  5. [SOLVED] Locating Duplicate Cell Data with a Cell Counter and Highlight
    By garrett.grillo in forum Excel General
    Replies: 1
    Last Post: 04-30-2012, 12:52 AM
  6. Reference counter
    By maxthebear in forum Excel General
    Replies: 2
    Last Post: 11-29-2011, 03:16 PM
  7. Using counter variable as cell reference
    By riwiseuse in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-22-2010, 03:03 PM
  8. Cell counter
    By Haza in forum Excel General
    Replies: 2
    Last Post: 01-20-2006, 10:20 AM

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