|
下記は記述の一部を抜粋いたしました。
記述のちょうど中段あたりで出力したい列をズラっと指定しているのですが
この状態ですとシートのデータ通りに吐き出されてしまいます。
出力されたデータに指定した文字が含まれていた場合に
その文字を指定した文字に変換したいのですが
どのように追記すればよいのでしょうか。
ご存知の方どうぞ教えてください。
Dim Z As Long
Dim ingFFF As Long
Dim intEEE As Integer
Dim vntAAA As Variant
Dim vntData As Variant
Dim vntCCC As Variant
Dim vntBBB As Variant
Dim strDDD As String
'出力ファイル名を取得
If Not GetWriteFile(vntCCC, ThisWorkbook.Path) Then
strDDD = "マクロがキャンセルされました"
GoTo Wayout
End If
'出力ファイルのOpen
intEEE = FreeFile
Open vntCCC For Output As intEEE
Dim y As Integer
Dim str_tmp As String
'どの位置から処理を行うのか
For y = 9 To 198
'データ行数を取得
str_tmp = ""
'9行目〜198行目の指定された列の情報を返す
str_tmp = str_tmp & ActiveSheet.Cells(y, 2)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 3)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 4)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 5)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 6)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 7)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 8)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 9)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 10)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 11)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 12)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 13)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 14)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 15)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 16)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 17)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 18)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 19)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 20)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 21)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 22)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 23)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 24)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 25)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 26)
str_tmp = str_tmp & "," & ActiveSheet.Cells(y, 27)
Print #intEEE, str_tmp
Next
'出力ファイルのClose
Close #intEEE
strDDD = "処理が完了しました"
Wayout:
MsgBox strDDD, vbInformation
End Sub
|
|