Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro help please


hi, i need some help writing a macro that cuts and pastes some rows into
a new sheet and saves it accordingly to a cell name.

e.g.

Repeating
Vendor ID
Number 1
total: $15

Repeating
Vendor ID
Number 2
total $20



so "Repeating" is the marker and i need it to take that certain chunk
and save it as the "Vendor ID" name so the first one would be named
"Number 1.xls"

thanks for the help!


--
MonkeyMe
------------------------------------------------------------------------
MonkeyMe's Profile: http://www.excelforum.com/member.php...o&userid=23526
View this thread: http://www.excelforum.com/showthread...hreadid=378527

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default macro help please

Sub test()
Dim oThis As Worksheet
Dim oWB As Workbook
Dim iLastRow As Long
Dim iStart As Long
Dim i As Long

Set oThis = ActiveSheet
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "A").Value = "Repeating" Then
If iStart 0 Then
Set oWB = Workbooks.Add
oThis.Range("A" & iStart & ":A" & i - 1).Copy
oWB.Worksheets(1).Range("A1")
oWB.SaveAs oThis.Cells(iStart + 2, "A") & ".xls"
End If
iStart = i
End If
Next i

End Sub


--
HTH

Bob Phillips

"MonkeyMe" wrote in
message ...

hi, i need some help writing a macro that cuts and pastes some rows into
a new sheet and saves it accordingly to a cell name.

e.g.

Repeating
Vendor ID
Number 1
total: $15

Repeating
Vendor ID
Number 2
total $20



so "Repeating" is the marker and i need it to take that certain chunk
and save it as the "Vendor ID" name so the first one would be named
"Number 1.xls"

thanks for the help!


--
MonkeyMe
------------------------------------------------------------------------
MonkeyMe's Profile:

http://www.excelforum.com/member.php...o&userid=23526
View this thread: http://www.excelforum.com/showthread...hreadid=378527



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro help please


hi, thanks for the quick reply!

but i get the error:
Run-time error '438'
Object doesn't support this property or method

do i have to enable something somewhere?


--
MonkeyMe
------------------------------------------------------------------------
MonkeyMe's Profile: http://www.excelforum.com/member.php...o&userid=23526
View this thread: http://www.excelforum.com/showthread...hreadid=378527

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default macro help please

That was probably a wrap-around problem. Try this version

Sub test()
Dim oThis As Worksheet
Dim oWB As Workbook
Dim iLastRow As Long
Dim iStart As Long
Dim i As Long

Set oThis = ActiveSheet
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "A").Value = "Repeating" Then
If iStart 0 Then
Set oWB = Workbooks.Add
oThis.Range("A" & iStart & ":A" & i - 1).Copy _
oWB.Worksheets(1).Range("A1")
oWB.SaveAs oThis.Cells(iStart + 2, "A") & ".xls"
End If
iStart = i
End If
Next i

End Sub



--
HTH

Bob Phillips

"MonkeyMe" wrote in
message ...

hi, thanks for the quick reply!

but i get the error:
Run-time error '438'
Object doesn't support this property or method

do i have to enable something somewhere?


--
MonkeyMe
------------------------------------------------------------------------
MonkeyMe's Profile:

http://www.excelforum.com/member.php...o&userid=23526
View this thread: http://www.excelforum.com/showthread...hreadid=378527



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro help please


thanks for the quick reply again
but now i get another error:
Run-time error '1004'
Method 'SaveAs' of object '_workbook' faile

--
MonkeyM
-----------------------------------------------------------------------
MonkeyMe's Profile: http://www.excelforum.com/member.php...fo&userid=2352
View this thread: http://www.excelforum.com/showthread.php?threadid=37852



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro help please


hey, thanks i fixed the problem. but its not looping through the whol
worksheet picking off each sectio

--
MonkeyM
-----------------------------------------------------------------------
MonkeyMe's Profile: http://www.excelforum.com/member.php...fo&userid=2352
View this thread: http://www.excelforum.com/showthread.php?threadid=37852

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default macro help please

What exactly do you mean, and how did you solve the previous problem?

--
HTH

Bob Phillips

"MonkeyMe" wrote in
message ...

hey, thanks i fixed the problem. but its not looping through the whole
worksheet picking off each section


--
MonkeyMe
------------------------------------------------------------------------
MonkeyMe's Profile:

http://www.excelforum.com/member.php...o&userid=23526
View this thread: http://www.excelforum.com/showthread...hreadid=378527



Reply
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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 09:54 AM.

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

About Us

"It's about Microsoft Excel"