+ Reply to Thread
Results 1 to 5 of 5

Loop Column, write to another

  1. #1
    Registered User
    Join Date
    06-20-2007
    Posts
    9

    Exclamation Loop Column, write to another

    I need to loop through a column (lets say column D), check the cell value

    - if the value is > 0, I need to put 40 in the corresponding cell in Column B
    - and if the value is < 0, I need to put 50 in the corresponding cell in Column B
    - and just ignore the blank cells

    Can someone help me here? Thanks !!!!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Something like this should work in the sheet's code module:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    or using select case

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    06-20-2007
    Posts
    9
    Thanks both of you!

    For some reason it is not writing the values to column B. Am I missing anything here?

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    You realize that those examples were not automated macros that occurs as you enter data, right? You have to manually run either of the macros provided by going to Tools -> Macros -> Macros, selecting the macro name and click Run.

    If you want something that happens automatically as you type in values, you can try something like this:
    Please Login or Register  to view this content.
    Put that in the worksheet's code window. Anytime you change a value in Column D, it will check and set column B's value to the appropriate number.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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