KenCriss
Active Member
- Joined
- Jun 6, 2005
- Messages
- 326
I have an add-in that is distributed in our offices in the US. One user is having a problem where the code below only writes out part of what it should. Let's say A1 is cDiv. A2 is A.
This code (which I use to write to a text file) usually writes out "A", in the output file. Instead, for this one user, it is writing out A", - leaving off the first ("). It does this for all the columns touched by this code.
I am thinking it is some setting that he has on his computer. Does anyone know of a way to capture a user's Excel settings as a way of debugging a problem like this? I cannot duplicate the problem on my PC.
This is only part of the code, but it's the part that creates the string to be written out.
This code (which I use to write to a text file) usually writes out "A", in the output file. Instead, for this one user, it is writing out A", - leaving off the first ("). It does this for all the columns touched by this code.
I am thinking it is some setting that he has on his computer. Does anyone know of a way to capture a user's Excel settings as a way of debugging a problem like this? I cannot duplicate the problem on my PC.
This is only part of the code, but it's the part that creates the string to be written out.
Code:
Any ideas would be appreciated...
Sub Data_C()
Dim i As Long
Dim r As Range
Dim find_cell As Range
Dim what As String
Dim FirstAddress As String
Dim lastcell As Range
Set r = Cells.Range("A1:IV1")
what = "c?"
With r
Set find_cell = .Find(what, LookAt:=xlPart)
If Not find_cell Is Nothing Then
FirstAddress = find_cell.Address
Do
If InStr(1, find_cell.Value, "c", vbTextCompare) = 1 Then
iPrg = iPrg + 1
sngpercent = iPrg / col_ctr
ProgressStyle1 sngpercent, True
If row_ctr = 2 Then
Set lastcell = Cells(row_ctr, find_cell.Column)
Set x = Range(find_cell.Offset(0, 0), lastcell)
Else
Set lastcell = Cells(row_ctr, find_cell.Column)
Set x = Range(find_cell.Offset(1, 0), lastcell)
End If
format_c_field_fast
End If
Set find_cell = .FindNext(find_cell)
Loop While Not find_cell Is Nothing And FirstAddress <> find_cell.Address
End If
End With
End Sub
Sub format_c_field_fast()
Dim mem As Variant
Dim i As Long
On Error Resume Next
x.SpecialCells(xlCellTypeBlanks) = " "
On Error GoTo 0
mem = x
For i = 1 To UBound(mem)
mem(i, 1) = """" & mem(i, 1) & """" & ","
Next i
x = mem
End Sub