Excel VBA Copy Worksheet Data and Cond. Formatting to Another Workbook/Worksheet

Thank you for looking at my question,

I started in on this and very quickly realised I was in over my head,

I have data in a worksheet, the Project is in Range("A2") and the Item is in Range("B2")

In the On-Click event of a userform button I need to :

1. Check Directory "Projects" to see if there is a workbook named with the value in Range("A2") - if it isn't there create it.
2. Create/Overwrite a worksheet in the target workbook named after the value in Range("B2") with the values and conditional formatting from the source worksheet.

Any help you can offer will be greatly appreciated.
Gary CroxfordOperations Support AnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
This assumes that the name of the sheet where A2 and B2 are is "Sheet1".
Private Sub CommandButton1_Click()
Dim wbSource As Workbook
Dim wbDest As Workbook
Dim ws As Worksheet
Dim strSheet As String
Set wbSource = ThisWorkbook

strSheet = Range("B2")
On Error Resume Next
Workbooks.Open "C:\Projects\" & wbSource.Sheets("Sheet1").Range("A2")
If Err.Number = 1004 Then
    Set wbDest = Workbooks.Add
    Application.DisplayAlerts = False
    wbDest.SaveAs Filename:="C:\Projects\" & wbSource.Sheets("Sheet1").Range("A2")
    Application.DisplayAlerts = True
    Set wbDest = ActiveWorkbook
End If
On Error GoTo 0

For Each ws In wbDest.Worksheets
    If ws.Name = strSheet Then
        Application.DisplayAlerts = False
        Application.DisplayAlerts = True
        Exit For
    End If

With wbSource
    .Sheets(strSheet).Copy Before:=wbDest.Sheets(1)
End With

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gary CroxfordOperations Support AnalystAuthor Commented:

works fine - thank you for your help
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.