A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Thank you. It works now.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Option Explicit
Private Sub CommandButton1_Click()
End Sub
Private Sub cmdCreateFile_Click()
Dim ColumnToSkip As Integer
Dim FileNumber As Integer
Dim K As Integer
Dim Limit As Integer
Dim LastColumn As Integer
Dim Marker As Integer
Dim StartColumn As Integer
Dim Y As Integer
Dim DataBucket As String
Dim Filename As String
Dim RangeName As String
Dim RawData As Range
StartColumn = 5
ColumnToSkip = 16
Filename = Trim(Range("I4"))
Set RawData = Range("A6").CurrentRegion
Limit = RawData.Rows.Count
LastColumn = RawData.Columns.Count
FileNumber = FreeFile
Open Filename For Output As FileNumber
Close FileNumber
Kill Filename
FileNumber = FreeFile
Open Filename For Output As FileNumber
For K = 5 To Limit
If Trim(RawData.Cells(K, 2)) <> "" And Trim(RawData.Cells(K, 3)) <> "" Then
'Row has some data to export
For Y = StartColumn To LastColumn
If Y <> ColumnToSkip Then
If Val(Trim(RawData.Cells(K, Y))) <> 0 Then mismatch
DataBucket = Trim(RawData.Cells(K, 2)) & "," & Trim(RawData.Cells(2, Y)) & "," & Trim(Str(Val(Trim(RawData.Cells(K, Y)))))
Print #FileNumber, DataBucket
End If
End If
Next Y
End If
Next K
Close FileNumber
'RawData.Select
End Sub
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Thank you. It works now.
Sub or Function is not defined
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
Do you get an error when you click the button?
If so: what does the error message say?