mismatch error in returning concatonation of numbers and characters

S

skrimpy

I have two cells in a row. By the nature of formulas within the cell
they will either have a number, or the text "n/a". I want to write
loop that will look into the second cell to see if "n/a" is present.
If it is "n/a" I want what is contained in the first cell to b
returned to a text box (t1), which could be a number or could be "n/a"
If the second cell contains a number, the first cell will also contai
a number, and I want both numbers returned to the text box (t1) with
comma between them. ie "15 , 16" or "15 , 15" etc..... I then wan
the loop to continue through 13 different sets of cells with on
corresponding text box. Here is what I have for the first set o
cells.

'Declare Variables
Dim Counter As Integer
Dim a As Byte
Dim b As Byte
Dim c As String
'Activate Worksheet and define range
Worksheets("Sheet1").Activate
'Initialize Variables
Counter = 0
a = 9
b = 3
c = Cells(b, a)
'Return values from cells
Do
If c = "n/a" Then
t1 = ActiveSheet.Cells(b, a - 1)
Else: t1 = ActiveSheet.Cells(b, a - 1) + "," + ActiveSheet.Cells(b
a)
End If
Counter = Counter + 1
Loop Until Counter = 1

I keep getting a type mismatch error. I think this is because I hav
numbers being returned :mad: in concatonation with a string characte
(the comma). Is there a way to convert those numbers to a string s
that I will not have this error? Or am I wrong about why I'm gettin
the error? Thanks to anyone that can help me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top