+ Reply to Thread
Results 1 to 8 of 8

VBA code .range problem

  1. #1
    Forum Contributor
    Join Date
    09-28-2016
    Location
    Seattle, washington
    MS-Off Ver
    2016
    Posts
    330

    VBA code .range problem

    Hello, On the attached spreadsheet when the data in column A, Active Opportunities changes to "Closed" it automatically moves to the "Closed Business" sheet, but it deletes other data that i need to keep past column Q. Any ideas on how to modify the code to fix this? I'm not sure how to change the range. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VBA code .range problem

    Maybe :
    Please Login or Register  to view this content.
    Attached Files Attached Files
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Forum Contributor
    Join Date
    09-28-2016
    Location
    Seattle, washington
    MS-Off Ver
    2016
    Posts
    330

    Re: VBA code .range problem

    Awesome Karedog, Works just like i need it to. I really appreciate it!

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VBA code .range problem

    You are welcome Steve, thanks for marking the thread as solved and for the rep.points.


    Regards

  5. #5
    Forum Contributor
    Join Date
    09-28-2016
    Location
    Seattle, washington
    MS-Off Ver
    2016
    Posts
    330

    Re: VBA code .range problem

    No Problem, Thank you. One other quick question if I could? In column "m" do you know why the cells in red display that number " of 30483"?? i would like it to be blank until the dates are put in. Thanks for your help.

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VBA code .range problem

    You can put this formula on cell M4 (and copied down) :

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    As for why it is returning 30483 if adjacent cell in column L is blank, the explanation is :
    - NETWORKDAYS(start_date,end_date,holidays) function return number of working days (5 days per week, Monday - Friday) between start date and end date, excluding holidays
    - If adjacent cell in column L is blank, this means start_date = 0
    - The value of end_date ($P$1) is 42681, you can examine this by change number format of cell $P$1 to General
    - The number holidays to be subtracted between start_date (0) and end_date (=TODAY()) is 3 days, defined on Data!$P$2:$P$11, that is : 04/07/2016, 05/09/2016, and 10/10/2016
    - So the days between end_date (426812) and start_date (0), excluding holidays is = 42681 -0 - 3 = 42678
    - Approx. of network days (5 days a week --> 5 / 7) = 5/7 * 42678 = 30484 --> (this is very close to 30483, it must be caused by rough calculation by very simple multiplying with 5/7)

  7. #7
    Forum Contributor
    Join Date
    09-28-2016
    Location
    Seattle, washington
    MS-Off Ver
    2016
    Posts
    330

    Re: VBA code .range problem

    Thank you again, I appreciate the explanation. Have not used the network day formulas that much. Have a good evening.

  8. #8
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VBA code .range problem

    You are welcome Steve, it is morning here in Indonesia. Have a wonderful evening.


    Regards

+ 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. Problem selecting a range in code
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2014, 06:37 AM
  2. [SOLVED] Range in code gives special problem
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-17-2013, 03:21 AM
  3. Problem using loop for sending excel range in email body using Range to HTML code
    By drajanm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2012, 03:17 AM
  4. Problem with Delete Row Code and Set Range
    By sunilmulay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2009, 11:59 PM
  5. [SOLVED] Problem getting the value of a Named Range in code
    By tbone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2006, 10:25 PM
  6. [SOLVED] Dynamic Range Offset causing problem with this code
    By Arishy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2005, 02:05 PM

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