我正試圖爲每天在工作中使用的工作表創建一個簡單的宏。帶偏移量的VBA宏
基本上它是關於:
表1個細胞A2:A11中有值的那些值需要被複制粘貼到片2具有偏移的每一天到下一個無柱。
到目前爲止我所得到的複製粘貼有一個偏移量......但我不知道如何說偏移量應該發生在下一個空白欄。
Dim rng As Range
Dim ws As Worksheet
Range("A2:A11").Select
Selection.Copy
Sheets("Sheet2").Select
If rng Is Nothing Then
'if nothing found - search for last non empty column
Set rng = ws.Range("2:2").Find(What:="*", LookAt:=xlWhole, MatchCase:=False, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious)
If rng Is Nothing Then
Set rng = rng.Offset(, 1)
ActiveSheet.Paste
End If
看起來像你缺少一個結束IF和rng沒有設置之前,你測試它是沒有。 – Rdster
@Jenni發佈你的其他代碼,這個當前代碼不能運行 –