請較一個簡單的excel巨集or vba問題

2009-02-03 6:13 pm
這是excel儲存格複製上去的~設A1:G9












12/3
D
2
GY
3FP
10
14.60

12/3
D
11
GY
3FP
10
15.31

12/3
N
2
GY
3FP
10
15.19

12/3
N
6
GY
3FP
10
15.21

12/3
N
11
GY
3FP
10
14.73

12/3
N
16
GY
3FP
10
14.56

12/3
N
16
GY
3FP
10
14.56

12/3
N
16
GY
3FP
10
14.56

 
 
 
 
 
 
 

我想當A9(那空格)填上數字之後,A10:G10會貼上A9:G9的"格式",這樣我就不用還要自行複製貼上格式供將來使用...可以一直持續下去...

回答 (2)

2009-02-03 7:30 pm
✔ 最佳答案

圖片參考:http://tw.yimg.com/i/tw/ugc/rte/smiley_4.gif
請參閱此巨集~
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo 10
i = [A65536].End(xlUp).Row
If Target.Row = i Then
Range(Cells(i - 1, 1), Cells(i - 1, 7)).Copy
Range(Cells(i, 1), Cells(i, 7)).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End If
10
End Sub
或請下載此檔參考~
http://www.FunP.Net/49592

圖片參考:http://tw.yimg.com/i/tw/ugc/rte/smiley_4.gif

http://tw.myblog.yahoo.com/vincent-excel

2009-02-03 21:16:44 補充:
按一下ENTER就可以囉~
2009-02-04 6:17 am
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = [A65536].End(xlUp).Row + 1 Then
Application.EnableEvents = False
Application.ScreenUpdating = False
Cells(Target.Row - 1, 1).Resize(, 7).Copy
Cells(Target.Row, 1).Resize(, 7).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
Target.Select
Application.ScreenUpdating = True
Application.EnableEvents = True
End If
End Sub

試試看此題解答。


收錄日期: 2021-04-15 19:48:40
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090203000016KK02762

檢視 Wayback Machine 備份