excel VB scripting issue

Posted on 2014-08-19
Last Modified: 2014-08-26
I have a work schedule, worksheet 2014, that contains the entire years working scheduled, vacations and time off.  The first 3 rows are meant to remain consistent as these don't change.  I publish 6 weeks of schedule to,  worksheet SP Publish, which is used to upload to a sharepoint site starting with the current Sunday workweek.  So I have a vb script that is meant to copy 6 weeks of calendar data, starting with the current weeks Sunday, select 6 weeks worth of calendar entries, copy that, clear the SP publish sheet and then paste 6 weeks worth of data into cell A4.  

Here are my issues:
1.  The copy seems to work just fine but as you can see in the SP Publish sheet I have two rows, 3 & 4 of days of the week.  I only need one.  Since I am a newbie to VB scripting I can't seem to find why this keeps happening.  Again, Rows 1 throug 3 on both the 2014 and SP Publish sheet are consistent.
2.   The last week of of schedule on the SP Publish worksheet is incomplete, the last record should end with Dan, so I am still missing two rows of data.  Some weeks it works and others it doesn't.  Since I used a fixed number of rows to publish I figured I had some extra rows which threw off the count but I havent seen any.  
3. The row heights for each indiviudal should be set to 26.4.  I couldn't fingure out a better way to set those row heights so as you can see at the end of the script I hard coded each range to update the row heights.  Is there another way to do this?  This seem a bit cumbersome to script it that way.
4. After I have selected the data in worksheet 2014 I want to show the rest of the calaendar to the end of the year.  Right now it only shows the current six weeks worth of data.  I want to see all of it.  Again, I had gotten thelp with this portion and don't understand how the code is working to make this change.

thanks for your help.
Question by:Rrave26
    LVL 35

    Expert Comment

    Here's the file back.

    Fixed last rows missing.
    The Year sheet will show everything again after your run the code
    Row height code is correct, doesn't matter how it looks, as it's fixed, the code works, and it won't fail.

    Your point 1 is totally messed up, have no idea what you mean. "SP Publish sheet I have two rows, 3 & 4 of days of the week.  I only need one". Be more specific? Maybe just use absolute points (See Cell A1 should be this, Row B should be that etc, etc etc)

    Author Comment

    Sorry point 1 was so confusing.  Lets try this:  Rows 1,2,3 on both sheets, 2014 and SP Publish,  should reflect the same format i.e., same Title and the days of the week.  The data on both sheets starts in the 4 row.  After running my script, prior to your enhancements, On the SP Publish worksheet, 4 row should start off with the current Sunday date, instead what I get is it repeats the day of the week in row 4 so now starting in cell c3 =Sunday, D3=MOnday....... and row 4 is see c4 =Sunday, D4=Monday....
    I would like the date to start n c4 not the day of the week.  

    Hope that helps.
    LVL 35

    Accepted Solution

    Actually on the publish sheet, I see no double lines, no repeats whatsoever. I only see it starts at row 4 instead of row 3. So that's what's changed in the new code. Please try again, and explain again if something is still not working.

    Author Closing Comment

    My issue has been fixed, thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
    Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  ( Here (http…
    The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now