macro to copy outlines and groups from excel to another spreadsheet

K

khaledab_86

Hellooo

Can someone please help ive been trying to do this for two months now
and am debating whether this is even possible now?

I have a spreadsheet that as lots of outlines and groups. What i want
to be able to do is have a macro that finds a specfic group and then
copy the content or sub tasks of that group.

The macro needs to keep in mind that the location of the groups is not
always in the same location within the spreadsheet and the volume of
the content can vary in terms of size.

further more the spreadsheet that it copies to needs too, the macro
must make sure that content already in the spreadsheet is not
overwritten, so should copy below onto the next line!

Hope that made sense, Any ideas anyone???

Here is the code so far:

Sub Copy()
' Open Data Dump workbook - the workbook to be copied too
Workbooks.Open Filename:="C:\Documents and Settings\Desktop\Tester
\Tester.xls"
Windows("Summary.xls").Activate


' Check if the first cell contains data. If not then close file
- will need a message box that tells me theres no data
'Sheet1.Activate
If WorksheetFunction.CountA(Cells) = 0 Then
ActiveWorkbook.Close SaveChanges:=False
ActiveWorkbook.Saved = True

'If Range(" Sheet1!A1") = "" Then
'ActiveWorkbook.Close SaveChanges:=False
'ActiveWorkbook.Saved = True

' If the cell does contain data then transfer the row of
data across to the Summary file
Else
' the ranges are abigious does not necessarily mean this will be the
distinct ranges at all time. I need a condition that allows a finding
of the specific subtask and then select its ranges

Range("A1:J300").Select
Selection.Copy
Windows("Tester.xls").Activate
Sheets("Sheet1").Activate
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=True

'Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
':=False, Transpose:=True

' Run the trade entry and formatting macros in Trade Data
file
'Enter_Trade
End If

' Save and close the Trade Data file
'ActiveWorkbook.Close SaveChanges:=True
'ActiveWorkbook.Saved = True
End Sub

Thanks sooo much youve no idea how much i will appreciate it if
someone can help

Kay
 
J

John

Hellooo

Can someone please help ive been trying to do this for two months now
and am debating whether this is even possible now?

I have a spreadsheet that as lots of outlines and groups. What i want
to be able to do is have a macro that finds a specfic group and then
copy the content or sub tasks of that group.

The macro needs to keep in mind that the location of the groups is not
always in the same location within the spreadsheet and the volume of
the content can vary in terms of size.

further more the spreadsheet that it copies to needs too, the macro
must make sure that content already in the spreadsheet is not
overwritten, so should copy below onto the next line!

Hope that made sense, Any ideas anyone???

Here is the code so far:

Sub Copy()
' Open Data Dump workbook - the workbook to be copied too
Workbooks.Open Filename:="C:\Documents and Settings\Desktop\Tester
\Tester.xls"
Windows("Summary.xls").Activate


' Check if the first cell contains data. If not then close file
- will need a message box that tells me theres no data
'Sheet1.Activate
If WorksheetFunction.CountA(Cells) = 0 Then
ActiveWorkbook.Close SaveChanges:=False
ActiveWorkbook.Saved = True

'If Range(" Sheet1!A1") = "" Then
'ActiveWorkbook.Close SaveChanges:=False
'ActiveWorkbook.Saved = True

' If the cell does contain data then transfer the row of
data across to the Summary file
Else
' the ranges are abigious does not necessarily mean this will be the
distinct ranges at all time. I need a condition that allows a finding
of the specific subtask and then select its ranges

Range("A1:J300").Select
Selection.Copy
Windows("Tester.xls").Activate
Sheets("Sheet1").Activate
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=True

'Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
':=False, Transpose:=True

' Run the trade entry and formatting macros in Trade Data
file
'Enter_Trade
End If

' Save and close the Trade Data file
'ActiveWorkbook.Close SaveChanges:=True
'ActiveWorkbook.Saved = True
End Sub

Thanks sooo much youve no idea how much i will appreciate it if
someone can help

Kay

Kay,
You have posted to a newsgroup that is dedicated to developer issues
with Microsoft Project, a planning and scheduling application. I suggest
you post to the microsoft.public.excel.programming newsgroup.

John
Project MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top