![]() |
Macro only working on 1 row
How can I get a macro to merge cells in the next row down rather than the
same row I recorded the macro in? |
Macro only working on 1 row
Post your code... and a little more description. Do you want the row just
below the active cell, or the first blank row or... -- HTH... Jim Thomlinson "naiveprogrammer" wrote: How can I get a macro to merge cells in the next row down rather than the same row I recorded the macro in? |
Macro only working on 1 row
I figured out that I don't need the merging macro now but rather a different
one. Same problem though- I need to add a new row & copy formatting as well as formulas when you add the new row. Here is my code: Sub AddEmp() ' ' AddEmp Macro ' Macro recorded 10/17/2005 by USER ' ' ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 3 ActiveWindow.ScrollColumn = 4 ActiveWindow.ScrollColumn = 5 ActiveWindow.ScrollColumn = 6 Range("B101:AK101").Select Selection.AutoFill Destination:=Range("B101:AK102"), Type:=xlFillDefault Range("B101:AK102").Select ActiveWindow.ScrollColumn = 5 ActiveWindow.ScrollColumn = 4 ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 1 Rows("102:102").Select Selection.RowHeight = 18 End Sub "Jim Thomlinson" wrote: Post your code... and a little more description. Do you want the row just below the active cell, or the first blank row or... -- HTH... Jim Thomlinson "naiveprogrammer" wrote: How can I get a macro to merge cells in the next row down rather than the same row I recorded the macro in? |
Macro only working on 1 row
Give this code a whril. You can use rngLast the same as you would use the
active cell. sub LastRow () Dim rngLast as Range Dim wks as Worksheet set wks = activesheet set rngLast = wks.cells(rows.count, "B").end(xlUp).offset(1, 0) rngLast.offset(0, -1).value = "Tada" rnglast.value = "Whee" rngLast.offset(0, 1).value = "Shazam" set rnglast = Nothing End Sub -- HTH... Jim Thomlinson "naiveprogrammer" wrote: I figured out that I don't need the merging macro now but rather a different one. Same problem though- I need to add a new row & copy formatting as well as formulas when you add the new row. Here is my code: Sub AddEmp() ' ' AddEmp Macro ' Macro recorded 10/17/2005 by USER ' ' ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 3 ActiveWindow.ScrollColumn = 4 ActiveWindow.ScrollColumn = 5 ActiveWindow.ScrollColumn = 6 Range("B101:AK101").Select Selection.AutoFill Destination:=Range("B101:AK102"), Type:=xlFillDefault Range("B101:AK102").Select ActiveWindow.ScrollColumn = 5 ActiveWindow.ScrollColumn = 4 ActiveWindow.ScrollColumn = 2 ActiveWindow.ScrollColumn = 1 Rows("102:102").Select Selection.RowHeight = 18 End Sub "Jim Thomlinson" wrote: Post your code... and a little more description. Do you want the row just below the active cell, or the first blank row or... -- HTH... Jim Thomlinson "naiveprogrammer" wrote: How can I get a macro to merge cells in the next row down rather than the same row I recorded the macro in? |
All times are GMT +1. The time now is 09:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com