Visual Basic Howto: Scattering values on a sheet

M

mshelly

I have been strugling with the following problem and am looking for
help.
On one sheet, I have 3 columns:
row column Value (a text string, the result of a
calculation and concatenation)

I would like to move the text string into the appropriate cell(row,
column) of another sheet, for all the occupied rows of the first sheet.

I keep getting type mismatch (error 13)

Can anyone help with this? I am familiar with Basic but not very
familiar with Visual Basic for Applications. Buying two books and
browsing them didn't help much.

Thanks in advance,

Mark
Rochester, NY
 
B

Bob Greenblatt

I have been strugling with the following problem and am looking for
help.
On one sheet, I have 3 columns:
row column Value (a text string, the result of a
calculation and concatenation)

I would like to move the text string into the appropriate cell(row,
column) of another sheet, for all the occupied rows of the first sheet.

I keep getting type mismatch (error 13)

Can anyone help with this? I am familiar with Basic but not very
familiar with Visual Basic for Applications. Buying two books and
browsing them didn't help much.

Thanks in advance,

Mark
Rochester, NY
You'd create a macro something like this:
Sub Movestuff()
Dim i As Integer
Dim irow As Integer
Dim sCol As String
i = 1
With Sheets("sheet1")
While Len(.Range("a" & i)) > 0
irow = .Range("a" & i)
sCol = .Range("b" & i)
Sheets("sheet2").Range(sCol & irow) = .Range("c" & i)
i = i + 1
Wend
End With
End Sub
 
M

mshelly

Bob,

Thanks, this did the trick. I used this basic idea, using
Sheets("sheet2").cells(irow,icol) to accomodate the integer data in the
first sheet.

Some of my earlier errors may also have been caused by having rows and
columns which were 0; I needed to add one.

Thanks for your help,

Mark Shelly
Rochester, NY
 

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