+ Reply to Thread
Results 1 to 8 of 8

Newbie loop through cells in a column question

  1. #1
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Newbie loop through cells in a column question

    Hi,

    I am trying to research and learn by trial and error but running into road blocks. Thanks to another member I got the script below working for 1 cell but now I am trying to make it loop through an entire column.

    Question 1: Does Range("B1:B") accomplish the same thing as Range("B1:B200") for specifying all the rows in a column?

    Question 2: My script below currently only works for the first cell then stops. What is the correct syntax to help it loop through all the rows?

    Thank you in advance.
    Please Login or Register  to view this content.
    Last edited by alansidman; 08-04-2019 at 09:20 AM.

  2. #2
    Registered User
    Join Date
    07-21-2019
    Location
    Italy
    MS-Off Ver
    2016
    Posts
    58

    Re: Newbie loop through cells in a column question

    Quote Originally Posted by Jadee77 View Post
    Hi,
    Question 1: Does Range("B1:B") accomplish the same thing as Range("B1:B200") for specifying all the rows in a column?
    The column B to the last full row:
    Please Login or Register  to view this content.
    All code:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Newbie loop through cells in a column question

    How about this.

    Please Login or Register  to view this content.
    though I don't see what v is supposed to be ?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Re: Newbie loop through cells in a column question

    Thank you both for the help. The looping works but somehow I've lost what the function was supposed to do (my fault I'm sure). I was trying to loop this script from below which looks for a carriage return in a cell and deletes everything after that. So the looping now works but it's no longer removing the extra characters after the carriage return. As you can tell I am very new at this so I must have changed something somehow. The original script does remove the extra characters but the looping one does not. Going to look at it more.

    Please Login or Register  to view this content.
    Last edited by alansidman; 08-04-2019 at 09:21 AM.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Newbie loop through cells in a column question

    @Jadee

    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. I have made the change for you today as you are new to the forum. Please observe all forum rules in the future)
    Last edited by alansidman; 08-04-2019 at 09:22 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Newbie loop through cells in a column question

    How about
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-03-2019
    Location
    Illinois
    MS-Off Ver
    Mac 14.7.7
    Posts
    17

    Re: Newbie loop through cells in a column question

    Hi, sorry I had to go out of town and I just wanted to thank you for all the responses. The last one seems to work the best. The first two got the looping working but it was giving me the same answer for every cell down the column (i.e. it kept pasting the "B1" value all the way down the next row) so I'm not sure how to fix that. If anyone sees this and wants to chime in on the first two replies to say how those could be corrected I would be interested because I'm trying to learn. Mainly I just wanted to say "THANKS". Really nice to help out this newbie

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Newbie loop through cells in a column question

    You're welcome & thanks for the feedback

+ 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] LOOP QUESTION to add the same data in one column but names aren't quite spelled the same
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2014, 02:32 PM
  2. newbie question with continuous loop
    By newbiewexcel in forum Excel General
    Replies: 2
    Last Post: 11-20-2013, 11:02 PM
  3. Replies: 2
    Last Post: 10-18-2013, 01:56 PM
  4. [SOLVED] Newbie question - splitting data from one column to two
    By jesse_mclean in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2012, 05:19 PM
  5. Newbie question: change column heading back to letter
    By dredwin in forum Excel General
    Replies: 1
    Last Post: 01-19-2010, 09:23 PM
  6. Replies: 3
    Last Post: 05-05-2006, 12:55 PM
  7. Newbie Question Column Adding Please Help
    By Tom Grassi in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-19-2005, 03:10 PM
  8. Newbie with newbie question
    By elgrandekazoo in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 03-28-2005, 02:13 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