我需要根据特定条件将给定行中的单元格A-M移动到另一张纸上。现在我正在使用移动整行的代码(见下文)。我如何编辑它以便仅从A-M获取值?我很欣赏任何见解,因为我对此非常陌生。谢谢!
Option Explicit
Sub Fr33M4cro()
Dim sh33tName As String
Dim custNameColumn As String
Dim i As Long
Dim stRow As Long
Dim customer As String
Dim ws As Worksheet
Dim sheetExist As Boolean
Dim sh As Worksheet
sh33tName = "New Providers - FPPE"
custNameColumn = "H"
stRow = 7
Set sh = Sheets(sh33tName)
For i = sh.Range(custNameColumn & sh.Rows.Count).End(xlUp).Row To stRow Step -1
customer = sh.Range(custNameColumn & i).Value
For Each ws In ThisWorkbook.Sheets
If StrComp(ws.Name, customer, vbTextCompare) = 0 Then
sheetExist = True
Exit For
End If
Next
If sheetExist Then
CopyRow i, sh, ws, custNameColumn
Else
InsertSheet customer
Set ws = Sheets(Worksheets.Count)
CopyRow i, sh, ws, custNameColumn
End If
Reset sheetExist
Next i
End Sub
Private Sub CopyRow(i As Long, ByRef sh As Worksheet, ByRef ws As Worksheet, custNameColumn As String)
Dim wsRow As Long
wsRow = ws.Range(custNameColumn & ws.Rows.Count).End(xlUp).Row + 1
ws.Rows(wsRow).EntireRow.Value = sh.Rows(i).EntireRow.Value
sh.Rows(i).EntireRow.Delete
End Sub
Private Sub Reset(ByRef x As Boolean)
x = False
End Sub
Private Sub InsertSheet(shName As String)
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = shName
End Sub
答案 0 :(得分:0)
在ubuntu 30450 ... /home/ubuntu/.rbenv/versions/2.3.1/bin/rake
功能中,请改为:
CopyRow