顯示具有 EXCEL 標籤的文章。 顯示所有文章
顯示具有 EXCEL 標籤的文章。 顯示所有文章

2010年11月2日 星期二

EXCEL 符合*字串的數量

有用到某區間內符合某個字串的數量有幾筆
所以找了一下
發現了這個用法
還不錯


=COUNTIF(P152:P201,"*")

這用法 是 P152~P201內有字串的都算一筆

" " 內就是你要用的字串

2010年10月20日 星期三

C# Excel 數字字串被轉成數字

因為產生EXCEL後
數字字串會很貼心的自己轉成數字型態
我前面的000都不見了!!!!!!!!!!!!

所以
在字串前面多了一個 ==> '
這樣就行了 XDDD

C# VS2010 Excel.ApplicationClass() 錯誤

在VS2010部分
Excel.ApplicationClass() 編譯會錯誤
因為已經改成宣告
Excel.Application()
這樣就行了

想說 奇怪 同程式怎不能跑
XDDD

2010年6月2日 星期三

Excel VBA 讀儲存格值


Dim a As Double
If Worksheets("超簡易算盤").Range("B2").Value <> 0 Then
a = Worksheets("超簡易算盤").Range("B1").Value / Worksheets("超簡易算盤").Range("B2").Value
Worksheets("超簡易算盤").Range("B5").Value = a
Else
Worksheets("超簡易算盤").Range("B5").Value = "B值不能等於0"
End If


語法
Worksheets("超簡易算盤").Range("B2").Value

說明:
叫出超簡易算盤資料表的B2儲存格的值 也可直接取代

Excel 跳資料表讀資料

說明:跳試算表讀取欄位方法:
範例:
險種一!E15
試算表名稱!(欄位)

Excel VBA 可讀取多筆txt資料

這是可以多筆txt匯入Execl的VBA程式
Try看看吧!!!

Sub inCSV()
x = InputBox("請輸入檔案數量")
Range("a1").Select
For i = 1 To x
If i = 1 Then
z = 1
Else
z = 1
End If
y = ActiveCell.Address
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\xx\" & i & ".txt", Destination:=Range(y))
.Name = "1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 950
.TextFileStartRow = z
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 1, 1, 5)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Application.CommandBars("External Data").Visible = False
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Next
End Sub
Private Sub CommandButton1_Click()
inCSV
End Sub

2010年2月9日 星期二

EXCEL $小說明

公式內$意思是鎖住
表示全套用時候無法更改
標事前無$才會隨著套用指定位置做位移

=$F1<>$C1 <==可隨著位置改變1值
=$F$1<>$C$1 <==全鎖死
=F1<>C1 <==隨著位置改變C F 跟1的值