excel VB scripting issue

Posted on 2014-08-19
Medium Priority
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
  • 2
  • 2
LVL 37

Expert Comment

ID: 40270384
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

ID: 40270457
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 37

Accepted Solution

Kimputer earned 2000 total points
ID: 40270495
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

ID: 40286521
My issue has been fixed, thanks.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

864 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