LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 45
Default need urgent help on macro merging

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging rows- urgent help req deepika :excel help[_2_] Excel Discussion (Misc queries) 2 February 22nd 08 02:20 PM
URGENT! Macro help on incremental numbering for printing KDG Excel Discussion (Misc queries) 2 October 30th 07 07:56 PM
MACRO URGENT HELP OSK Excel Discussion (Misc queries) 2 June 29th 07 09:08 PM
Urgent - Help VBA Macro Jeff Excel Discussion (Misc queries) 8 October 3rd 05 08:25 PM
URGENT Mac/PC macro compatibility problem marika1981 Excel Discussion (Misc queries) 7 January 8th 05 12:43 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"