ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MERGE CELL BY MACRO (https://www.excelbanter.com/excel-programming/406201-merge-cell-macro.html)

K[_2_]

MERGE CELL BY MACRO
 
Hi, I have this macro (please see below) which insert lines . What
should
I add in this macro that it should merge cells from coloumn "I" to
coloumn
"N" in those inserted rows.
MACRO:-
Sub InsertIt()
* * Dim LastRow As Long
* * Dim StartRow As Long

* * StartRow = ActiveCell.Row

* * Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

* * LastRow = Cells(Rows.Count, 1).End(xlUp).Row

* * Application.ScreenUpdating = False
* * With Range(Cells(StartRow, 1), Cells(LastRow, 1))
* * * * .DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
* * * * * * Step:=1, Trend:=False
* * End With
* * Application.ScreenUpdating = True

End Sub

I posted smilar question before please see the link below for more
understanding
about question. Thanks

http://groups.google.com/group/micro...95cb9ab9e89f5b

Bernie Deitrick

MERGE CELL BY MACRO
 
K,

Just after this line:

Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

Add this line

Cells(StartRow + 1, 9).Resize(6, 6).Merge

HTH,
Bernie
MS Excel MVP


"K" wrote in message
...
Hi, I have this macro (please see below) which insert lines . What
should
I add in this macro that it should merge cells from coloumn "I" to
coloumn
"N" in those inserted rows.
MACRO:-
Sub InsertIt()
Dim LastRow As Long
Dim StartRow As Long

StartRow = ActiveCell.Row

Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

Application.ScreenUpdating = False
With Range(Cells(StartRow, 1), Cells(LastRow, 1))
..DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
End With
Application.ScreenUpdating = True

End Sub

I posted smilar question before please see the link below for more
understanding
about question. Thanks

http://groups.google.com/group/micro...95cb9ab9e89f5b



K[_2_]

MERGE CELL BY MACRO
 
On 15 Feb, 17:19, "Bernie Deitrick" <deitbe @ consumer dot org wrote:
K,

Just after this line:

Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

Add this line

Cells(StartRow + 1, 9).Resize(6, 6).Merge

HTH,
Bernie
MS Excel MVP

"K" wrote in message

...
Hi, I have this macro (please see below) which insert lines . What
should
I add in this macro that it should merge cells from coloumn "I" to
coloumn
"N" in those inserted rows.
MACRO:-
Sub InsertIt()
Dim LastRow As Long
Dim StartRow As Long

StartRow = ActiveCell.Row

Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

Application.ScreenUpdating = False
With Range(Cells(StartRow, 1), Cells(LastRow, 1))
.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
End With
Application.ScreenUpdating = True

End Sub

I posted smilar question before please see the link below for more
understanding
about question. *Thanks

http://groups.google.com/group/micro...rogramming/bro...


Hi Bernie,

Thanks for replying. the line you told me to add into my macro was
fine but a little problem is that as my macro add
6 rows and i want 6 rows to be merge saperatly from coloumn "I" to
coloumn "N" and with adding your line it merge all
6 rows and make one big cell. is there way that i can merge cells by
each row.

Bernie Deitrick

MERGE CELL BY MACRO
 
Sorry about that...

For i = 1 To 6
Cells(StartRow + i, 9).Resize(1, 6).Merge
Next i

HTH,
Bernie
MS Excel MVP


"K" wrote in message
...
On 15 Feb, 17:19, "Bernie Deitrick" <deitbe @ consumer dot org wrote:
K,

Just after this line:

Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

Add this line

Cells(StartRow + 1, 9).Resize(6, 6).Merge

HTH,
Bernie
MS Excel MVP

"K" wrote in message

...
Hi, I have this macro (please see below) which insert lines . What
should
I add in this macro that it should merge cells from coloumn "I" to
coloumn
"N" in those inserted rows.
MACRO:-
Sub InsertIt()
Dim LastRow As Long
Dim StartRow As Long

StartRow = ActiveCell.Row

Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

Application.ScreenUpdating = False
With Range(Cells(StartRow, 1), Cells(LastRow, 1))
.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
End With
Application.ScreenUpdating = True

End Sub

I posted smilar question before please see the link below for more
understanding
about question. Thanks

http://groups.google.com/group/micro...rogramming/bro...


Hi Bernie,

Thanks for replying. the line you told me to add into my macro was
fine but a little problem is that as my macro add
6 rows and i want 6 rows to be merge saperatly from coloumn "I" to
coloumn "N" and with adding your line it merge all
6 rows and make one big cell. is there way that i can merge cells by
each row.



K[_2_]

MERGE CELL BY MACRO
 
On 15 Feb, 20:56, "Bernie Deitrick" <deitbe @ consumer dot org wrote:
Sorry about that...

For i = 1 To 6
* * Cells(StartRow + i, 9).Resize(1, 6).Merge
Next i

HTH,
Bernie
MS Excel MVP

"K" wrote in message

...
On 15 Feb, 17:19, "Bernie Deitrick" <deitbe @ consumer dot org wrote:





K,


Just after this line:


Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert


Add this line


Cells(StartRow + 1, 9).Resize(6, 6).Merge


HTH,
Bernie
MS Excel MVP


"K" wrote in message


...
Hi, I have this macro (please see below) which insert lines . What
should
I add in this macro that it should merge cells from coloumn "I" to
coloumn
"N" in those inserted rows.
MACRO:-
Sub InsertIt()
Dim LastRow As Long
Dim StartRow As Long


StartRow = ActiveCell.Row


Cells(StartRow + 1, 1).Resize(6, 1).EntireRow.Insert


LastRow = Cells(Rows.Count, 1).End(xlUp).Row


Application.ScreenUpdating = False
With Range(Cells(StartRow, 1), Cells(LastRow, 1))
.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
Step:=1, Trend:=False
End With
Application.ScreenUpdating = True


End Sub


I posted smilar question before please see the link below for more
understanding
about question. Thanks


http://groups.google.com/group/micro...rogramming/bro...


Hi Bernie,

Thanks for replying. *the line you told me to add into my macro was
fine but a little problem is that as my macro add
6 rows and i want 6 rows to be merge saperatly from coloumn "I" to
coloumn "N" and with adding your line it merge all
6 rows and make one big cell. is there way that i can merge cells by
each row.- Hide quoted text -

- Show quoted text -


Thanks Bernie the macro is working like a charm. Thanks a lot


All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com