Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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?

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 that isn't working Brad Excel Discussion (Misc queries) 2 October 29th 09 08:23 PM
Macro working bar Alberto Ast[_2_] Excel Discussion (Misc queries) 14 September 12th 09 03:12 PM
macro was working, now it's not working RichardO[_11_] Excel Programming 2 June 9th 04 06:27 AM
Macro working in Excel 2003; not working in Excel 2000 Leslie Barberie Excel Programming 5 May 20th 04 07:51 PM
Macro not working ced[_2_] Excel Programming 1 September 18th 03 10:09 PM


All times are GMT +1. The time now is 10:05 PM.

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

About Us

"It's about Microsoft Excel"