各位高手好
小弟是巨集初心者
這是自己學習後寫的第二個巨集
先說明我的需求:
主要是圖一為從URL下載的員工資料
因欄位中含有空格
需要在B欄位插入TRIM公式做調整
=TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," ")))
但不知為何巨集沒成功
麻煩大神們幫小弟看看哪裡不對
謝謝
【CODE】
Sub dept()
'
' dept 巨集
'
'
Cells.Select
Selection.RowHeight = 20
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A1").Select
Selection.Copy
Range("B1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("B2").Select
ActiveCell.FormulaR1C1 = "=TRIM(CLEAN(SUBSTITUTE(RC[-1],CHAR(160),"" "")))"
Range("B2").Select
Selection.Copy
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 26
ActiveWindow.ScrollRow = 27
ActiveWindow.ScrollRow = 28
ActiveWindow.ScrollRow = 29
ActiveWindow.ScrollRow = 30
ActiveWindow.ScrollRow = 31
ActiveWindow.ScrollRow = 34
ActiveWindow.ScrollRow = 35
ActiveWindow.ScrollRow = 36
ActiveWindow.SmallScroll Down:=6
Range("B2:B1000").Select
ActiveSheet.Paste
Range("D7").Select
Application.CutCopyMode = False
Columns("B:B").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C3").Select
Application.CutCopyMode = False
End Sub