Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a group of spreadsheets in a workbook, which I filter at the end of
each week. What I am now trying to do is to copy that filtered data to another spreadsheet that I call €śWeekly Totals€ť, all sheets are in one workbook. I have create code that will filter each sheet the way I want to see the information, but when I copy it over to my €śWeekly Totals€ť sheet, this then is where I am having the problem. Sheet 1 has four lines of filtered data that is copied by macro to the sheet €śWeekly Totals€ť, now when I want to copy sheet 2s information, which only has one line of filtered data in this example, it will erase sheets one data, and copy sheet two data in the first row. Im starting this copy process to cell A1 Some of the code that I have tried are the following: Sub Macro1() Dim mlastrow as Integer mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUP).Row + 1 End Sub Or Debug.Print Activesheet.Range(€śA65536€ť).End(xlUp).Row + 1 Or Sub Macro1() Dim mlastrow as Range Mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUp).Row End Sub Why are the above formulas not working the way I expect them to work? Walter |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
'Do your filter paste results ' 'reset mlastrow to the new last row mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results "Walter" wrote: I have a group of spreadsheets in a workbook, which I filter at the end of each week. What I am now trying to do is to copy that filtered data to another spreadsheet that I call €śWeekly Totals€ť, all sheets are in one workbook. I have create code that will filter each sheet the way I want to see the information, but when I copy it over to my €śWeekly Totals€ť sheet, this then is where I am having the problem. Sheet 1 has four lines of filtered data that is copied by macro to the sheet €śWeekly Totals€ť, now when I want to copy sheet 2s information, which only has one line of filtered data in this example, it will erase sheets one data, and copy sheet two data in the first row. Im starting this copy process to cell A1 Some of the code that I have tried are the following: Sub Macro1() Dim mlastrow as Integer mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUP).Row + 1 End Sub Or Debug.Print Activesheet.Range(€śA65536€ť).End(xlUp).Row + 1 Or Sub Macro1() Dim mlastrow as Range Mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUp).Row End Sub Why are the above formulas not working the way I expect them to work? Walter |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mike,
By changing the "A" to a 1, did not fix the problem, sheet 2 still pasted over the information from sheet 1 that was pasted in the worksheet "Weekly Totals". Steve "Mike" wrote: mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results ' 'reset mlastrow to the new last row mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results "Walter" wrote: I have a group of spreadsheets in a workbook, which I filter at the end of each week. What I am now trying to do is to copy that filtered data to another spreadsheet that I call €śWeekly Totals€ť, all sheets are in one workbook. I have create code that will filter each sheet the way I want to see the information, but when I copy it over to my €śWeekly Totals€ť sheet, this then is where I am having the problem. Sheet 1 has four lines of filtered data that is copied by macro to the sheet €śWeekly Totals€ť, now when I want to copy sheet 2s information, which only has one line of filtered data in this example, it will erase sheets one data, and copy sheet two data in the first row. Im starting this copy process to cell A1 Some of the code that I have tried are the following: Sub Macro1() Dim mlastrow as Integer mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUP).Row + 1 End Sub Or Debug.Print Activesheet.Range(€śA65536€ť).End(xlUp).Row + 1 Or Sub Macro1() Dim mlastrow as Range Mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUp).Row End Sub Why are the above formulas not working the way I expect them to work? Walter |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Also I should say that I looked for past questions regarding this issue, and
that is where I gleamed some of the code from, 'looking for next empty row' Walter "Mike" wrote: mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results ' 'reset mlastrow to the new last row mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results "Walter" wrote: I have a group of spreadsheets in a workbook, which I filter at the end of each week. What I am now trying to do is to copy that filtered data to another spreadsheet that I call €śWeekly Totals€ť, all sheets are in one workbook. I have create code that will filter each sheet the way I want to see the information, but when I copy it over to my €śWeekly Totals€ť sheet, this then is where I am having the problem. Sheet 1 has four lines of filtered data that is copied by macro to the sheet €śWeekly Totals€ť, now when I want to copy sheet 2s information, which only has one line of filtered data in this example, it will erase sheets one data, and copy sheet two data in the first row. Im starting this copy process to cell A1 Some of the code that I have tried are the following: Sub Macro1() Dim mlastrow as Integer mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUP).Row + 1 End Sub Or Debug.Print Activesheet.Range(€śA65536€ť).End(xlUp).Row + 1 Or Sub Macro1() Dim mlastrow as Range Mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUp).Row End Sub Why are the above formulas not working the way I expect them to work? Walter |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Post some of your code let us look at it
"Walter" wrote: Also I should say that I looked for past questions regarding this issue, and that is where I gleamed some of the code from, 'looking for next empty row' Walter "Mike" wrote: mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results ' 'reset mlastrow to the new last row mlastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'Do your filter paste results "Walter" wrote: I have a group of spreadsheets in a workbook, which I filter at the end of each week. What I am now trying to do is to copy that filtered data to another spreadsheet that I call €śWeekly Totals€ť, all sheets are in one workbook. I have create code that will filter each sheet the way I want to see the information, but when I copy it over to my €śWeekly Totals€ť sheet, this then is where I am having the problem. Sheet 1 has four lines of filtered data that is copied by macro to the sheet €śWeekly Totals€ť, now when I want to copy sheet 2s information, which only has one line of filtered data in this example, it will erase sheets one data, and copy sheet two data in the first row. Im starting this copy process to cell A1 Some of the code that I have tried are the following: Sub Macro1() Dim mlastrow as Integer mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUP).Row + 1 End Sub Or Debug.Print Activesheet.Range(€śA65536€ť).End(xlUp).Row + 1 Or Sub Macro1() Dim mlastrow as Range Mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUp).Row End Sub Why are the above formulas not working the way I expect them to work? Walter |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi
i think you may have a conceptual problem. all of the example code you posted produced a number, not a range. you want to paste at a range. i tested all and all but the last worked as expected(i did have to replace your double quotes to make it work.) the last example crashes because it is expecting a range object, not a long.(integer?) the example code you posted usually is used to find the last row NUMBER and is then used in a for next loop.... for myloop = 1 to mlastrow mlastrow is the last row number and to select the last row number, use something like.... rows(mlastrow).select but this is not good for it doesn't put you at a specific place on the row to paste. maybe.. Range("A" & mlastrow).Select or just Range("A" & mlastrow).paste you could also use.. sheet1.select range("A2").end(xldown).offset(1,0).pastespecial xlpasteall and not use any of the code you posted. lot of ways to do this. post your pasting code. regards FSt1 "Walter" wrote: I have a group of spreadsheets in a workbook, which I filter at the end of each week. What I am now trying to do is to copy that filtered data to another spreadsheet that I call €śWeekly Totals€ť, all sheets are in one workbook. I have create code that will filter each sheet the way I want to see the information, but when I copy it over to my €śWeekly Totals€ť sheet, this then is where I am having the problem. Sheet 1 has four lines of filtered data that is copied by macro to the sheet €śWeekly Totals€ť, now when I want to copy sheet 2s information, which only has one line of filtered data in this example, it will erase sheets one data, and copy sheet two data in the first row. Im starting this copy process to cell A1 Some of the code that I have tried are the following: Sub Macro1() Dim mlastrow as Integer mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUP).Row + 1 End Sub Or Debug.Print Activesheet.Range(€śA65536€ť).End(xlUp).Row + 1 Or Sub Macro1() Dim mlastrow as Range Mlastrow=Cells(Rows.Count,€ťA€ť).End(xlUp).Row End Sub Why are the above formulas not working the way I expect them to work? Walter |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding Next empty +1 | Excel Programming | |||
Finding next empty empty cell in a range of columns | Excel Programming | |||
Finding the first empty row with VBA | Excel Programming | |||
Finding last row that is empty | Excel Programming | |||
Finding last non-empty column in row... | Excel Programming |