Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
Are you an avid runner? Or even just starting out?

Brooks designs high-performance men's and women's running shoes, apparel and accessories.
From our sponsors
VBA 資料會將最後一列資料問題
Jan 27th 2014, 01:23

各位大大~
小弟是初學者,如描述上有問題請各位大大見諒~
小弟遇到問題如下~
1.會先將一個開啟的檔案先做資料處理,然後利用VBA打開某個特定路徑的檔案
去尋找有資料最後一列並將複製的資料貼上,可是這樣會將最後一列資料給
覆蓋!! 請問有解決的方式嗎?該檔案關閉時是否可直接儲存不出現詢問視窗?

2.當我資料貼上該開啟檔案後我又要在該檔案處理格式或資料整理,但我怎麼
確認我貼過去的資料範圍呢?(欄固定,列不固定)

3.如果我使用自訂表單(使用不同的處理資料方式),該如何執行那段程式就好呢?

Columns("C:C").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
'Selection.Delete Shift:=xlToLeft
Columns("F:I").Select
Selection.Delete Shift:=xlToLeft
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
Columns("F:F").Select
Selection.Insert Shift:=xlToRight
Range("D2:E2").Select '選取並改變時間格式
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormatLocal = "h:mm;@"

Range("B2:H2").Select '選取並以時間排序
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlStroke, DataOption1:=xlSortNormal

Range("B2:H2").Select '全部選取
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy '複製

'開啟指定檔案
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\桌面\新增Microsoft Excel 工作表.xls"
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\桌面\新增Microsoft Excel 工作表.xls"

Sheets("資料整理").Select '選取資料Sheet
Range("B65536").Select
Selection.End(xlUp).Select '尋找有資料的最後一列
ActiveSheet.Paste

Workbooks("新增Microsoft Excel 工作表.xls").Close

End Sub

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜

    qhhxf0jm2bil3 發表在 痞客邦 留言(0) 人氣()