D
deepika :excel help
The following macro merges correctly entries which jhave more than one row
,,, but when only one entry per name is available then it merges along with
it the next row also. can any1 pls tell me where i have to correct
Dim e As Integer
e = 1000
Dim i1 As Integer
Dim st As Integer
i1 = 3
st = 3
Dim name As String
Dim sr As Integer
Dim ps As Long
name = Cells(i1, 2).value
sr = Cells(i1, 1).value
ps = Cells(i1, 3).value
For i1 = 3 To e
If (name <> Range("B" & i1)) And (sr <> Range("A" & i1)) And (ps <>
Range("C" & i1)) Then
Range("B" & st & ":B" & i1 - 1).merge
Range("A" & st & ":A" & i1 - 1).merge
Range("C" & st & ":C" & i1 - 1).merge
name = Cells(i1 + 1, 2).value
sr = Cells(i1 + 1, 1).value
ps = Cells(i1 + 1, 3).value
st = i1
ElseIf (name = Range("B" & i1) And i1 <> 3) Then
Range("A" & i1) = ""
Range("B" & i1) = ""
Range("C" & i1) = ""
End If
Next i1
,,, but when only one entry per name is available then it merges along with
it the next row also. can any1 pls tell me where i have to correct
Dim e As Integer
e = 1000
Dim i1 As Integer
Dim st As Integer
i1 = 3
st = 3
Dim name As String
Dim sr As Integer
Dim ps As Long
name = Cells(i1, 2).value
sr = Cells(i1, 1).value
ps = Cells(i1, 3).value
For i1 = 3 To e
If (name <> Range("B" & i1)) And (sr <> Range("A" & i1)) And (ps <>
Range("C" & i1)) Then
Range("B" & st & ":B" & i1 - 1).merge
Range("A" & st & ":A" & i1 - 1).merge
Range("C" & st & ":C" & i1 - 1).merge
name = Cells(i1 + 1, 2).value
sr = Cells(i1 + 1, 1).value
ps = Cells(i1 + 1, 3).value
st = i1
ElseIf (name = Range("B" & i1) And i1 <> 3) Then
Range("A" & i1) = ""
Range("B" & i1) = ""
Range("C" & i1) = ""
End If
Next i1