+ Reply to Thread
Results 1 to 3 of 3

Excel VB Script to Enter Data based on whether a Cell is empty or not

  1. #1
    Registered User
    Join Date
    09-17-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003
    Posts
    5

    Excel VB Script to Enter Data based on whether a Cell is empty or not

    Hello everyone...

    I have to insert data into Column C of a spreadsheet based on whether Column A or B are empty or not.

    Attached excel file "test1.xls" shows the output format as well as what i have so far in terms of macro and here is the code which I have so far..

    Please Login or Register  to view this content.
    basically, as you would notice that the first 2 entries in Column C match the desired output because the number of entries in Column B is only one. The moment there are more entries than one in Column B, I am unable to skip the rows eg. skipping rows from C6 to C10 in this case.

    Any help in this regard is greatly appreciated...

    Thanks all in advance :-)
    Attached Files Attached Files
    Last edited by timepass111; 09-19-2011 at 10:32 AM. Reason: Query solved by Jerry

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Excel VB Script to Enter Data based on whether a Cell is empty or not

    Since what you want to do can be done with a simple formula, in C2, then copied down:

    =IF($A2<>"", $A2&".pdf", "")


    ...then you can do that in a macro too with no looping:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-17-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Excel VB Script to Enter Data based on whether a Cell is empty or not

    Thanks a lot Jerry... this works like a charm..

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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