+ Reply to Thread
Results 1 to 2 of 2

How to create macro to add data based on relative data?

  1. #1
    Registered User
    Join Date
    07-01-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    2

    How to create macro to add data based on relative data?

    Hey this is my first post.

    I'm creating a macro that will involve some form of if-else/case-switch, as well as a loop (probably), but I'm not too sure how to go about it.

    Basically there are records in columns. Lets say Column A has numbers in it, for example

    Cell A1 has "Three"
    A2 has "Five"
    A3 has "Two" all without quotes

    I basically want a macro that will loop through the whole column, so if A1 contains "Three" (not case sensitive), then set B1 to "3" without quotes. If A2 contains "Two", then the macro will set B2 to "2" without quotes.

    Of course this is sample data but you get the jist. It needs to loop through one column, so as to fill in the other column. You can assume that column A will always be filled, so the macro is being created to automatically fill in column B based on what is in column A.

    Any help would be appreciated. Thanks!

  2. #2
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: How to create macro to add data based on relative data?

    for this purpose ...
    you have to first define excel that "Two" = "2" (without quotes)....
    till your all number gets defined...
    ifs and loops come later..

    Say thanks, Click *

+ 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: 19
    Last Post: 05-13-2013, 01:08 PM
  2. Replies: 11
    Last Post: 05-12-2013, 11:30 AM
  3. Importing XML through VBA macro, create schema based on xml source data
    By foxyfmu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-03-2013, 01:18 PM
  4. [SOLVED] macro to create rows of data based on divided quantities
    By MSApprentice in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2011, 12:19 PM
  5. Replies: 1
    Last Post: 07-01-2011, 12:37 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