返回列表 上一主題 發帖

[發問] Range(Cells(1324, 71), Cells(1380, 80))語法有錯嗎?

[發問] Range(Cells(1324, 71), Cells(1380, 80))語法有錯嗎?

請教先進大大
With Sheets("TempA")
         Sheets("Temp").Range(Cells(1324, 71), Cells(1380, 80)).Copy   .Cells(4, 5)
End With
出現錯誤1004
而改用
With Sheets("TempA")
        Sheets("Temp").Range("BS1324:CB1380").Copy    .Cells(4, 5)
End With  
就可以
為什麼呢?
以前常用Range(Cells(1,1),cells(2,4))取代Range("A1:D2")是可行的呀!   
為什麼呢?

回復 1# yangjie

With Sheets("TempA")
         Sheets("Temp").Range(Sheets("Temp").Cells(1324, 71), Sheets("Temp").Cells(1380, 80)).Copy   .Cells(4, 5)
End With
學海無涯_不恥下問

TOP

將 With Sheets("TempA") 改為 With Sheets("Temp") 節省程式碼長度

With Sheets("Temp")
         .Range(.Cells(1324, 71), .Cells(1380, 80)).Copy   Sheets("TempA").Cells(4, 5)
End With
{...} 表示需要用 CTRL+SHIFT+ENTER 三鍵輸入公式

TOP

本帖最後由 yangjie 於 2014-6-30 20:14 編輯

謝了
完全吸收
又有一奇想      想再請教兩位版主:
有無方式寫法可將Excel  各欄各列(不含上面功能列)
完全搬入userform內(含卷軸)
或者
使Excel 剩下各欄各列(不含上面功能列)(含卷軸)利用ComdButton再恢復原使或userform
極想了解,學習。謝謝!

TOP

回復 4# yangjie
全螢幕檢視是否符合需求?

    play.gif
學海無涯_不恥下問

TOP

回復 4# yangjie
你可以往Microsoft Office Spreadsheet control找找,應該符合需求
不過我也沒實作的經驗。

TOP

回復 6# stillfish00
請教stillfish00
如您所言所圖
將A.xls  sheets(1) 拉入userform1
userform1  應如何下語法

TOP

本帖最後由 Hsieh 於 2014-7-3 15:11 編輯

回復 5# Hsieh
請教Hseih 版大     個人參考您的  可否幫我檢視
'取消視窗的...
Sub hideAll()
  With Application
    If .Version >= 12# Then
        Application.DisplayFullScreen = False
    Else
        '將2003所有命令列隱藏
        For Each theBar In .CommandBars
            '將顯示中的命令列收集起來並隱藏
            On Error Resume Next
            If theBar.Enabled Then
                theCollection.Add theBar, theBar.Name
                theBar.Enabled = False
            End If
            On Error GoTo 0
        Next
        '2003狀態列
        .DisplayStatusBar = False
    End If
    .DisplayFormulaBar = False
    .DisplayScrollBars = True
    .Caption = " "
    .ActiveWindow.Caption = ""
    .ActiveWindow.DisplayHeadings = True
    .ActiveWindow.DisplayWorkbookTabs = False
    .WindowState = xlMaximized
  End With
  app_Initialize
  canClose = "False"
End Sub
[attach]18608[/attach][attach]18609[/attach]又如附件  開起密碼 520
在office2010 2013 均出現  "編譯錯誤發生於此隱藏模組"-----
可否幫我開開看   錯誤在哪?
(將登錄檔0701.xls 置入學生管理資料夾開0701.xls)

TOP

回復 5# Hsieh
請教Hseih 版主
      在設定引用項目 勾掉遺漏;Calendar control11.0  一切均以解決
樓上8#壓縮之檔可請您刪除嗎?(因含許多人名)拜託!

TOP

回復 6# stillfish00
請教stillfish00
6#之圖內容是如何做到的? 可否教一教?

TOP

        靜思自在 : 生氣,就是拿別人的過錯來懲罰自己。
返回列表 上一主題