Home > Software engineering >  For the great god, urgently, online etc.! thank you
For the great god, urgently, online etc.! thank you

Time:09-24

On condition that
If the Ax is not equal to A (x - 1) then in Ax and insert A line between A (x - 1), and copies Ax in the whole column to insert the line, and the newly inserted the Cx (C in Numbers) for the * 0.5
If the Ax is not equal to A (x + 1) then in Ax and insert A line between A (x + 1), and copies Ax in the whole column to insert the line, and the newly inserted the Cx (C in Numbers) for the * 1.5
For example,
If A2 is not equal to A1, then insert a row between listed in columns 1 and 2, and copies the contents of the two columns to the newly inserted in the line, and new insert that the C2 * 0.5 (to insert a new line. As a result, the original A2 into A3, insert the lines into A2)
Do not know to have to say what I mean,,, is a small white form for VBA, wish you a great god can help!!
Thank you very much!!!!!!
Below is a sample with pictures, the code running before and after contrast, sincerely for advice!

CodePudding user response:





This is running before and after the reference, thank you for your great god

Such as online code

CodePudding user response:

Didn't understand what you mean...

CodePudding user response:

According to the data of the building Lord,
Raw data:

Perform a code:


Code:
 Option Explicit 

Private Sub Main ()
Dim vText As String
Dim vCurr As Long
Dim vSave As Long
Dim pi& , pn As Long

VSave=1 & amp;
PI=2 'data "starting line 2
"Do
VText=Sheet1. Cells (PI, 1). The Text
If (vText="") Then Exit the Do
VCurr=Val (vText)
If (vSave Xor vCurr) Then
Pn=PI
PI=1 & amp; + PI
Sheet1. Rows (pn). Insert the Shift:=xlDown
Sheet1. Range (" A "& amp; PI & amp; : "H" & amp; PI). Copy Sheet1. Range (" A "& amp; Pn)
3, Sheet1. Cells (pn) Value=https://bbs.csdn.net/topics/0.5 * Sheet1 in Cells (PI, 3). The Value
End the If
VSave=Val (Sheet1. Cells (PI + 1 & amp; , 1). The Text)
If (vSave Xor vCurr) Then
Pn=1 & amp; + PI
Sheet1. Rows (pn). Insert the Shift:=xlDown
Sheet1. Range (" A "& amp; PI & amp; : "H" & amp; PI). Copy Sheet1. Range (" A "& amp; Pn)
3, Sheet1. Cells (pn) Value=https://bbs.csdn.net/topics/1.5 * Sheet1 in Cells (PI, 3). The Value
PI=1 & amp; + pn
The Else
PI=1 & amp; + PI
End the If
VSave=vCurr
Loop
End Sub

Maybe the actual data type, are not consistent with your "example",
Your reference and change,
  •  Tags:  
  • VBA