Home > Software engineering >  Pray god to help see consolidation cell, part I have written. For the first time, for advice
Pray god to help see consolidation cell, part I have written. For the first time, for advice

Time:09-23

BBS great god help me to take A look at this table, demand A to I have the same merge, T to U have the same merge, the trouble to see attachment, thank you, only last A little, thank you, now test and line 9, line 10 merger, no other can
(the original table)

(want)

(code)

CodePudding user response:

Thank you, thank you, for the first time

CodePudding user response:

Start recording macros in Excel 2003, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,

CodePudding user response:

So long haven't solve?
Want to know how to solve, you can reply it, it's a waste of feelings or someone else said,

CodePudding user response:

Debug it and see if processing to the line 10,

CodePudding user response:

Estimate is grave,

CodePudding user response:

reference 5 floor Chen8013 reply:
estimation has become a grave,

One thousand dig grave, such as

CodePudding user response:

The Public Function exceldc (ByVal tt As String)
Dim t As Integer
Dim As Integer B
B=1
The Set xlsApp=CreateObject (" Excel. Application ")
The Set XLSWB=xlsApp. Workbooks. Open (tt) 'to Open the document path
The Set XLSWS=XLSWB. Worksheets (1)
XlsApp. DisplayAlerts=False
The Set Worksheet.=xlsApp ActiveSheet
'to get the data
'xlsWs. Range (Cells (1, 2), Cells (1, 5)). The Merge' merger a1:
b2 cellFor ff=1 To XLSWS. UsedRange. Columns. The Count
If XLSWS. Cells (1, ff)=XLSWS. Cells (1, ff + 1), Then the
T=t + 1
The Else
If the t & gt; 0 Then
XLSWS. Range (XLSWS. Cells (1, ff - t), XLSWS. Cells (1, ff)). The Merge 'merger a1:
b2 cellT=0
End the If
End the If
If XLSWS. Cells (1, ff)=XLSWS. Cells (ff) 2, Then
XLSWS. Range (XLSWS. Cells (1, ff), XLSWS) Cells (2, ff)). The Merge 'merger a1:
b2 cellEnd the If
Next ff
XLSWB. Save
XLSWB. Close
XlsApp. Quit
The Set XLSWS=Nothing
The Set XLSWB=Nothing
The Set xlsApp=Nothing

Shell "CMD. Exe/c start" & amp; Tt, vbMaximizedFocusL

End the Function
This represents my used to merge header, the same to merge, you take to change yourself!
  •  Tags:  
  • VBA
  • Related