[算表] excel請教單元格絕對引用
軟體:ms2007
版本:2007
比如絕對引用A1 可以直接寫成=$A$1,但我要類似這樣格式寫=$"A"&$ROW(A1)
就是行數要用row返回,就是要當我刪除工作表多余列,引用的單元格的行數不
變,請問該怎么寫
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.38.52.180
※ 文章網址: https://www.ptt.cc/bbs/Office/M.1440244540.A.599.html
※ 編輯: yyingx (27.38.52.180), 08/22/2015 20:04:03
→
08/22 20:04, , 1F
08/22 20:04, 1F
→
08/22 20:05, , 2F
08/22 20:05, 2F
→
08/22 20:07, , 3F
08/22 20:07, 3F
→
08/22 20:20, , 4F
08/22 20:20, 4F
→
08/22 20:29, , 5F
08/22 20:29, 5F
→
08/22 20:30, , 6F
08/22 20:30, 6F
→
08/22 20:30, , 7F
08/22 20:30, 7F
→
08/22 20:35, , 8F
08/22 20:35, 8F
→
08/22 20:36, , 9F
08/22 20:36, 9F
→
08/22 20:39, , 10F
08/22 20:39, 10F
→
08/22 20:42, , 11F
08/22 20:42, 11F
→
08/22 21:04, , 12F
08/22 21:04, 12F
→
08/22 21:05, , 13F
08/22 21:05, 13F
→
08/22 21:05, , 14F
08/22 21:05, 14F
→
08/22 21:12, , 15F
08/22 21:12, 15F
→
08/22 21:13, , 16F
08/22 21:13, 16F
→
08/22 21:13, , 17F
08/22 21:13, 17F
→
08/22 21:24, , 18F
08/22 21:24, 18F
→
08/22 21:25, , 19F
08/22 21:25, 19F
→
08/22 21:42, , 20F
08/22 21:42, 20F
→
08/22 21:58, , 21F
08/22 21:58, 21F
→
08/22 21:59, , 22F
08/22 21:59, 22F
→
08/22 22:00, , 23F
08/22 22:00, 23F
→
08/22 22:02, , 24F
08/22 22:02, 24F
=SUMPRODUCT(INDIRECT("[成品入倉記2.xls]成品入庫!G4:G5600")="TZR")....
我是跨檔了,跨檔文件也打開了,但還是報錯了
※ 編輯: yyingx (27.38.52.180), 08/22/2015 22:03:33
※ 編輯: yyingx (27.38.52.180), 08/22/2015 22:04:29
→
08/22 22:07, , 25F
08/22 22:07, 25F
→
08/22 22:08, , 26F
08/22 22:08, 26F
→
08/22 22:10, , 27F
08/22 22:10, 27F
→
08/22 22:10, , 28F
08/22 22:10, 28F
→
08/22 22:10, , 29F
08/22 22:10, 29F
→
08/22 22:15, , 30F
08/22 22:15, 30F
→
08/22 22:19, , 31F
08/22 22:19, 31F
→
08/22 22:24, , 32F
08/22 22:24, 32F
→
08/22 22:35, , 33F
08/22 22:35, 33F
→
08/23 12:25, , 34F
08/23 12:25, 34F
→
08/23 12:26, , 35F
08/23 12:26, 35F
→
08/23 12:35, , 36F
08/23 12:35, 36F
→
08/23 12:35, , 37F
08/23 12:35, 37F
→
08/23 12:36, , 38F
08/23 12:36, 38F
還有 39 則推文
還有 2 段內文
→
08/24 00:45, , 78F
08/24 00:45, 78F
→
08/24 00:46, , 79F
08/24 00:46, 79F
因為跨檔文件是xlsx,所以我寫成了這樣
Sub ADO查詢()
Dim cnn As Object, SQL$
Set cnn = CreateObject("adodb.connection")
cnn.Open "provider=microsoft.jet.oledb.12.0;extended properties='excel 1
2.0;hdr=yes';data source=" & ThisWorkbook.Path & "\.成品入倉記2.xlsx"
SQL = "select sum(庫存支) from [Sheet2$a3:w65536] where 備注='楊明'"
Range("A2").CopyFromRecordset cnn.Execute(SQL)
cnn.Close
Set cnn = Nothing
End Sub
※ 編輯: yyingx (27.38.52.180), 08/24/2015 00:48:47
→
08/24 00:47, , 80F
08/24 00:47, 80F
→
08/24 00:48, , 81F
08/24 00:48, 81F
→
08/24 00:49, , 82F
08/24 00:49, 82F
→
08/24 00:52, , 83F
08/24 00:52, 83F
→
08/24 00:53, , 84F
08/24 00:53, 84F
→
08/24 01:01, , 85F
08/24 01:01, 85F
→
08/24 01:02, , 86F
08/24 01:02, 86F
→
08/24 01:03, , 87F
08/24 01:03, 87F
→
08/24 01:04, , 88F
08/24 01:04, 88F
Sub ADO查詢()
Dim cnn As Object, SQL$
Set cnn = CreateObject("adodb.connection")
cnn.Open "provider=Microsoft.ACE.OLEDB.12.0;extended properties=excel 12
.0;hdr=yes';data source=" & ThisWorkbook.Path & "\成品入倉記2.xlsx"
SQL = "select sum(庫存支) from [Sheet2$a3:w6000] where 備注='楊明'"
Range("A100").CopyFromRecordset cnn.Execute(SQL)
cnn.Close
Set cnn = Nothing
End Sub
※ 編輯: yyingx (27.38.52.180), 08/24/2015 01:05:23
※ 編輯: yyingx (27.38.52.180), 08/24/2015 01:07:06
→
08/24 01:07, , 89F
08/24 01:07, 89F
→
08/24 01:13, , 90F
08/24 01:13, 90F
→
08/24 01:14, , 91F
08/24 01:14, 91F
Sub ADO查詢()
Dim cnn As Object, SQL$
Set cnn = CreateObject("adodb.connection")
cnn.Open "provider=Microsoft.ACE.OLEDB.12.0;extended properties=excel 12
.0;hdr=yes';data source=" & ThisWorkbook.Path & "\成品入倉記2.xlsx"
SQL = "select sum(庫存支) from [成品入庫$a3:w6000] where 備注 ='楊明'"
Range("A100").CopyFromRecordset cnn.Execute(SQL)
cnn.Close
Set cnn = Nothing
End Sub
※ 編輯: yyingx (27.38.52.180), 08/24/2015 01:18:43
→
08/24 01:21, , 92F
08/24 01:21, 92F
→
08/24 01:21, , 93F
08/24 01:21, 93F
→
08/24 01:21, , 94F
08/24 01:21, 94F
Sub ADO查詢()
Dim cnn As Object, SQL$
Set cnn = CreateObject("adodb.connection")
cnn.Open "provider=Microsoft.ACE.OLEDB.12.0;extended properties='excel 1
2.0;hdr=yes';data source=" & ThisWorkbook.Path & "\成品入倉記2.xlsx"
SQL = "select sum(庫存支) from [成品入庫$a3:w6000] where 備注 ='楊明'"
Range("A100").CopyFromRecordset cnn.Execute(SQL)
cnn.Close
Set cnn = Nothing
End Sub
※ 編輯: yyingx (27.38.52.180), 08/24/2015 01:25:54
→
08/24 01:26, , 95F
08/24 01:26, 95F
→
08/24 01:26, , 96F
08/24 01:26, 96F
→
08/24 01:27, , 97F
08/24 01:27, 97F
→
08/24 01:27, , 98F
08/24 01:27, 98F
→
08/24 01:30, , 99F
08/24 01:30, 99F
→
08/24 01:30, , 100F
08/24 01:30, 100F
→
08/24 01:31, , 101F
08/24 01:31, 101F
→
08/24 01:34, , 102F
08/24 01:34, 102F
→
08/24 01:36, , 103F
08/24 01:36, 103F
→
08/24 01:39, , 104F
08/24 01:39, 104F
→
08/24 01:39, , 105F
08/24 01:39, 105F
→
08/24 01:44, , 106F
08/24 01:44, 106F
→
08/24 01:45, , 107F
08/24 01:45, 107F
→
08/24 07:08, , 108F
08/24 07:08, 108F
→
08/24 07:09, , 109F
08/24 07:09, 109F
→
08/24 07:17, , 110F
08/24 07:17, 110F
→
08/25 21:26, , 111F
08/25 21:26, 111F
→
08/25 23:49, , 112F
08/25 23:49, 112F
→
08/26 21:42, , 113F
08/26 21:42, 113F
Office 近期熱門文章
PTT數位生活區 即時熱門文章