ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Merge Cells with excel 2003 (https://www.excelbanter.com/excel-programming/374141-merge-cells-excel-2003-a.html)

jfcby[_2_]

Merge Cells with excel 2003
 
Hello,

I have a worksheet that I would like to merge 2 cells each row (200
rows and several worksheets) begining with A6:B6.

Below is a code I've tried to modify but I still can't get it to work
right. Can this code be changed to merge 2 cells begining with A6:B6
through 200 rows?

Sub TryNow2()
Dim i As Integer
For i = 0 To 2
Cells(6, i * 1 + 1).Resize(1, 2).Merge
Next i
End Sub

Thanks for your help in advance,
jfcby


JLGWhiz

Merge Cells with excel 2003
 
Your code as written will walk through the columns not the rows. Your
counter should be in the first part of the parenth, i.e.
For i = 0 To 194
Cells(i*1+6,1)

"jfcby" wrote:

Hello,

I have a worksheet that I would like to merge 2 cells each row (200
rows and several worksheets) begining with A6:B6.

Below is a code I've tried to modify but I still can't get it to work
right. Can this code be changed to merge 2 cells begining with A6:B6
through 200 rows?

Sub TryNow2()
Dim i As Integer
For i = 0 To 2
Cells(6, i * 1 + 1).Resize(1, 2).Merge
Next i
End Sub

Thanks for your help in advance,
jfcby



jfcby[_2_]

Merge Cells with excel 2003
 
Thank you JLGWhiz the code modification works great!!!!

jfcby

JLGWhiz wrote:
Your code as written will walk through the columns not the rows. Your
counter should be in the first part of the parenth, i.e.
For i = 0 To 194
Cells(i*1+6,1)

"jfcby" wrote:

Hello,

I have a worksheet that I would like to merge 2 cells each row (200
rows and several worksheets) begining with A6:B6.

Below is a code I've tried to modify but I still can't get it to work
right. Can this code be changed to merge 2 cells begining with A6:B6
through 200 rows?

Sub TryNow2()
Dim i As Integer
For i = 0 To 2
Cells(6, i * 1 + 1).Resize(1, 2).Merge
Next i
End Sub

Thanks for your help in advance,
jfcby





All times are GMT +1. The time now is 04:15 PM.

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