+ Reply to Thread
Results 1 to 6 of 6

macro to select cell with data in from defined range

  1. #1
    Registered User
    Join Date
    11-13-2013
    Location
    United Kingdom
    MS-Off Ver
    Mac 2011
    Posts
    34

    macro to select cell with data in from defined range

    Hi,

    I have a very complex spreadsheet with over 200 rows of data, this data is spread over 3 columns with only one piece of data in each row. I want to write a macro to scan the cells, select the one with data, and depending on which column that data falls in apply a calculation to it, then drop to the next row and repeat.

    eg. start with B3:D3, look across range, select cell with data (in this example it is B3) then apply this calculation =1-exp(-1*A3*$B$2) (A3 is a relative reference to the data, ie in B7 the calculation will be =1-exp(-1*A7*$B$2). then drop to row #4.

    in range B4:D4, look across range, select cell with data (here it is C4) run this calculation, (A4/2)*$C$2. then drop to row #5

    in range B4:D4, look across range select cell with data (here it is D5) run this calculation, (A5/2)*$D$2. the drop to row #6 etc...

    i have made a simple example of my spreadsheet example vlookups.xlsx

    All help will be much appreciated.
    Last edited by will.girling; 03-25-2014 at 01:01 PM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: macro to select cell with data in from defined range

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-13-2013
    Location
    United Kingdom
    MS-Off Ver
    Mac 2011
    Posts
    34

    Re: macro to select cell with data in from defined range

    thanks that works for column B, but how would i say if the data falls in column C calculate using (A4/2)*$C$2, or in column d calculate using (A5/2)*$D$2??

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: macro to select cell with data in from defined range

    Try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-13-2013
    Location
    United Kingdom
    MS-Off Ver
    Mac 2011
    Posts
    34

    Re: macro to select cell with data in from defined range

    Yes - that works well, thanks john!

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: macro to select cell with data in from defined range

    You're welcome. Glad to help out and 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. Replies: 4
    Last Post: 06-17-2013, 05:21 AM
  2. Select all objects in a defined range
    By Kalutschi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-15-2013, 06:19 AM
  3. Macro to Insert defined integer into range defined by variable criteria
    By stereofeedback in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2013, 12:33 PM
  4. [SOLVED] new to macro. seeking help on select range with defined minimum.
    By aballoonflies in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-10-2013, 09:25 PM
  5. [SOLVED] VBA to select a defined range
    By Shawn in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-21-2005, 04:05 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