返回列表 上一主題 發帖

[發問] 排序後刪除特定攔位

回復 10# billchenfantasy
land_no_m, land_no_c 每張表都有嗎?
  1.     If Not (IsError(Application.Match("land_no_m", .Rows(1), 0)) Or _
  2.             IsError(Application.Match("land_no_c", .Rows(1), 0))) Then
  3.         .[A1].CurrentRegion.Sort Key1:=.Columns(Application.Match("land_no_m", .Rows(1), 0)), _
  4.                                     Order1:=xlAscending, _
  5.                                     Key2:=.Columns(Application.Match("land_no_c", .Rows(1), 0)), _
  6.                                     Order2:=xlAscending, _
  7.                                     Header:=xlYes
  8.     Else
  9.         MsgBox .Sheets(i).Name & " : Sorting field not found."
  10.     End If
複製代碼

TOP

@@是的每張欄位格式都是一樣的,所以land_no_m, land_no_c 每張表都有,只有少數才有多一行的狀況才會想說指定欄位,感謝您的再度協助

TOP

回復 12# billchenfantasy
恩 試了一下  #10 的兩行順序調換
結果應該跟 #11 一樣

TOP

        靜思自在 : 屋寬不如心寬。
返回列表 上一主題