ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help req in merging cells (https://www.excelbanter.com/excel-discussion-misc-queries/177245-help-req-merging-cells.html)

deepika :excel help[_2_]

Help req in merging cells
 
i have written the following code to merge cells inside a macro.



Name = "Prathap"
S = 1
e = 1
For i = S To e
If (Name < Sheets("FTP").Cells(i, 2).Value) Then
Range(B,start:B,end)
Name = Sheets("FTP").Cells(i, 2).Merge
S = i + 1
e = i

Here what i wanted to convey is taht i want to merge all the cells of
columns A ,B and C for a particular name i col B. teh rest of teh columns
need not be merged . and then the following name is also to bemerged the same
way.
The entries are dynamic . Im not able to proceed beyond this as im new to
coding

Gary''s Student

Help req in merging cells
 
Perhaps this code can help you:

Sub mergge()
For I = 1 To 10
If Cells(I, 2).Value = "Prathap" Then
Range("A" & I & ":C" & I).merge
End If
Next
End Sub

--
Gary''s Student - gsnu200769


"deepika :excel help" wrote:

i have written the following code to merge cells inside a macro.



Name = "Prathap"
S = 1
e = 1
For i = S To e
If (Name < Sheets("FTP").Cells(i, 2).Value) Then
Range(B,start:B,end)
Name = Sheets("FTP").Cells(i, 2).Merge
S = i + 1
e = i

Here what i wanted to convey is taht i want to merge all the cells of
columns A ,B and C for a particular name i col B. teh rest of teh columns
need not be merged . and then the following name is also to bemerged the same
way.
The entries are dynamic . Im not able to proceed beyond this as im new to
coding


deepika :excel help[_2_]

Help req in merging cells
 
this code is actually deleing all teh entries below that row... Actually i
want to only merge one column .. the other columns should not be merged..

I have written the following code which doent work

i=3
Name = "Prathap"
st = i
en = i
If (Name < Sheets("FTP").Cells(i, 2).Value) Then
st = i + 1
en = i
Else
Sheets("FTP").Cells(i, 2).merge
name = Sheets("FTP").Cells(i+1, 2).Value

End If

also teh structure has to be like :
colA col B Col C
Row1 1 Prathap paint
row2 draw
row3 2 Rohan test

before the above , the structure is now like
colA col B Col C
Row1 1 Prathap paint
row2 1 Prathap draw
row3 2 Rohan test

So howmany ever Prathap i see i should merge it to a single cell leaving col
C unmerged and for teh rest of the rows... also this shud be teh case..
Can u help pls







"Gary''s Student" wrote:

Perhaps this code can help you:

Sub mergge()
For I = 1 To 10
If Cells(I, 2).Value = "Prathap" Then
Range("A" & I & ":C" & I).merge
End If
Next
End Sub

--
Gary''s Student - gsnu200769


"deepika :excel help" wrote:

i have written the following code to merge cells inside a macro.



Name = "Prathap"
S = 1
e = 1
For i = S To e
If (Name < Sheets("FTP").Cells(i, 2).Value) Then
Range(B,start:B,end)
Name = Sheets("FTP").Cells(i, 2).Merge
S = i + 1
e = i

Here what i wanted to convey is taht i want to merge all the cells of
columns A ,B and C for a particular name i col B. teh rest of teh columns
need not be merged . and then the following name is also to bemerged the same
way.
The entries are dynamic . Im not able to proceed beyond this as im new to
coding



All times are GMT +1. The time now is 03:00 AM.

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