LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Need contigency plans for data transfer ...

Hi -

I've searched the archives for help on this, but have succeeded in
only confusing myself further -- so I need your help!

I need to check that a workbook contains all 3 worksheets in a
specified array, creating any that are missing -- the code will
(eventually) transfer data from 'basebook' to 'HoursFile'. My
current code is below -- why isn't it working? The line it errors on
is marked.

Thanks, ray


Private Sub SubmitWeekly_Click()
Dim basebook As Workbook, Path As String, HoursFile As Workbook
Dim sh As Worksheet

Set basebook = ThisWorkbook
Store = basebook.Sheets("DB - Hours Reporting").Range("K7").Value
Path = "\\.....\FY08\Hours Report_" & Store & ".xls"

' Check that a STORE # has been entered
If Store = "" Then
Call MsgBox("You MUST select a store before continuing
with this action ....", vbExclamation, "No store selected!")
basebook.Sheets("DB - Hours
Reporting").Range("K7").Select
Exit Sub
Else
End If

If Dir(Path) = "" Then
Workbooks.Add.SaveAs Filename:=Path
Sheets.Add.Name = "wkly Sales"
Sheets.Add.Name = "wkly Hours"
Sheets.Add.Name = "mthly hours"
Else
End If

Set HoursFile = Workbooks.Open(Filename:=Path)

sh = Sheets(Array("wkly Sales", "wkly Hours", "mthly hours"))
'ERRORS OUT HERE!
For Each Sheet In sh
If Not WorksheetExists(sh, HoursFile) Then Sheets.Add.Name
= sh
Next

ActiveSheet.Range("G20").Value = Now

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel & Powerpoint lesson plans? collzy Excel Discussion (Misc queries) 4 January 15th 10 04:19 PM
Need a function for my teaching plans ArthurN Excel Worksheet Functions 5 April 5th 08 06:49 AM
training plans sherif Excel Discussion (Misc queries) 1 October 4th 07 09:07 AM
npv calc for customer pay plans Juan Valdez Excel Worksheet Functions 1 September 25th 06 03:02 AM
automatic time plans jammy20466 Excel Discussion (Misc queries) 0 June 27th 06 09:34 AM


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"