+ Reply to Thread
Results 1 to 6 of 6

How do you get a value from a cell while looping through the cells of another column?

  1. #1
    Registered User
    Join Date
    11-25-2013
    Location
    Urbutt
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question How do you get a value from a cell while looping through the cells of another column?

    Hi all,

    Self-taught Excel noob here. I've been trying to get something done that I just can't figure out how to even though I know it's simple but I'm still struggling a bit with VBA synthax and logic.

    Say you have a spreadsheet with 3 columns A, B, C. A has strings, B has numbers and C has numbers too. So we'd have something like:

    A B C
    x 3 20
    y 6 35
    z 2 33

    In my project, I'm looping through each cell in column C. What I want, is that when a number in C is, for instance >= 30, it goes and searches for the String in the same row in column A. I then want to use that string to put in an e-mail title.

    There's no need to display the entire code so I'll just put the part that errors each time. I've tried loads of things (Offset etc.) but no go:

    Please Login or Register  to view this content.
    I don't know if it's explicit enough but the code is pretty straight forward, how do I get the string in column A when the value of Column C is >= 25?

    Any help appreciated!

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: How do you get a value from a cell while looping through the cells of another column?

    Hi, pumpkin00,

    either
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    11-25-2013
    Location
    Urbutt
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How do you get a value from a cell while looping through the cells of another column?

    Hi Holger,

    Thanks for the quick response. I'm however getting a Run-Time Error 1004 with either of your code?

    I can post the complete code if needed, there might be something missing.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: How do you get a value from a cell while looping through the cells of another column?

    Hi, pumpkin00,

    my bad - the first should read
    Please Login or Register  to view this content.
    while the second should be
    Please Login or Register  to view this content.
    I should try and post less than 100% error raising code

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    11-25-2013
    Location
    Urbutt
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: How do you get a value from a cell while looping through the cells of another column?

    Awe-SOME! Thanks Holger, works perfectly. Don't worry about error raising code, really appreciate someone helping this quick !

    I was sure I tried the Offset method and it didn't work, probably wrote it wrong .

    Meh, anyways, thanks again!

  6. #6
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How do you get a value from a cell while looping through the cells of another column?

    @HaHoBe: My situation is more or less same as mentioned here. I tried the solution that you suggested above but it doesn't work for me, empty cell is not updated with other cell's value.

    I'm sorry for hijacking this thread, I'm just so desperate right now.

+ 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. Looping through the cells in a column and transpose
    By skpandian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2013, 06:08 AM
  2. [SOLVED] Do Loop with If End If statement crashing- looping through column to copy adjacent cell
    By Auwal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2012, 02:33 PM
  3. Ignore Errors on multi-cell range without looping over cells
    By dlh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2011, 08:25 PM
  4. looping through records of left column until cell is empty
    By johnmerlino in forum Excel General
    Replies: 1
    Last Post: 09-23-2010, 04:32 AM
  5. Determine if range has NO Blank Cells without looping through each cell in range
    By Excelenator in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2006, 01:35 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