我正在研究这个问题的变体:
Split single row into multiple rows based on cell value in excel
在旧的问题中,海报希望从包含特定值的每个单元格开始一个新行。我想知道在包含特定值的单元格之后是否有任何方法可以启动新行?
我已经调整了链接代码以供我使用,它运行得很好,但是它为我的数据创建了一个新的行一个单元格。最初的问题是大约一年半的时间,并且有一个接受的答案,所以我不知道评论是否会得到答复。
如果这不是网站的正确协议,我道歉。任何帮助将不胜感激!
Dim rngColLoop As Range
Dim rngSheet1 As Range
Dim wksSheet2 As Worksheet
Dim intColCounter As Integer
Dim intRowCounter As Integer
Sheets.Add.Name = "Sheet2"
With Worksheets("2014-2633")
Set rngSheet1 = .Range(.Range("R1"), .Range("R1").End(xlToRight))
End With
Set wksSheet2 = Worksheets("Sheet2")
intRowCounter = 1
intColCounter = 0
wksSheet2.Range("A1").CurrentRegion.Clear
With rngSheet1
For Each rngColLoop In .Columns
If Trim(rngColLoop) <> "" Then
If (Trim(rngColLoop)) <> "TennesseeSigned" Then
intColCounter = intColCounter + 1
wksSheet2.Cells(intRowCounter, intColCounter) = rngColLoop
ElseIf (Trim(rngColLoop)) = "TennesseeSigned" Then
intRowCounter = intRowCounter + 1
intColCounter = 1
wksSheet2.Cells(intRowCounter, intColCounter) = rngColLoop
End If
End If
Next rngColLoop
End With
Set rngColLoop = Nothing
Set rngSheet1 = Nothing
Set wksSheet2 = Nothing
答案 0 :(得分:1)
一种简单的方法是检测变化并设置一个布尔变量。然后测试此变量以在下一个循环周期中进行更改,如下所示:
$check = "SELECT count(*) FROM usuarios WHERE usuario = '" . $user . "' AND contraseña = md5('" . $pass . "')";
希望这有帮助。