need urgent help on macro merging

  • Thread starter deepika :excel help
  • Start date
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
 
F

FSt1

hi
use these 4 fomulas
formula assumes the wrapped text is in D8. adjust to suit.

=LEFT(D8,77) gets first line
=MID(D8,79,74) gets second line
=MID(D8,153,71) gets third line
=RIGHT(D8,26) gets last line

regards
FSt1
 
D

deepika :excel help

but how do i say that within a macro... and i m actually merging rows of A,B
and C cols which are dynamic
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top