Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |