J
JimFor
Hi,
I'm working on a program and have received the following error message when I
try to run it.
"Run-time error 104
Application-defined or object-defined error"
I am trying to use a counter to transfer cell data from sheet 1 to sheet 2.
For example, I have data in the first five rows in column A. I want to, say,
transter the data from the last four rows in Col A to sheet 2. But I will do
it according which cell is made active based on a "counter" value. Right now
I am only writing part of that part of the program. Here is my code:
Sub MySub()
'Transfer sheet data according to i
Dim Total As Double
Dim i As Integer
i = 1
Total = 1
For i = 1 To 3
Total = Total + i
Fred
Next i
End Sub
Sub Fred()
Worksheets("Sheet2").Cells(Total, 1).Value = Worksheets("Sheet1").Cells(Total,
1).Value
End Sub
For example, when the counter is 2 the value in cell (2,1) in sheet 1 is placed
in cell (2,1) on sheet 2. When the counter is 4, the value in cell (4,1) in
sheet 1 is placed in cell (4,1). Hope this is clear. Can anyone tell me what
I am doing wrong and what I can do to fix it?
Thanks
I'm working on a program and have received the following error message when I
try to run it.
"Run-time error 104
Application-defined or object-defined error"
I am trying to use a counter to transfer cell data from sheet 1 to sheet 2.
For example, I have data in the first five rows in column A. I want to, say,
transter the data from the last four rows in Col A to sheet 2. But I will do
it according which cell is made active based on a "counter" value. Right now
I am only writing part of that part of the program. Here is my code:
Sub MySub()
'Transfer sheet data according to i
Dim Total As Double
Dim i As Integer
i = 1
Total = 1
For i = 1 To 3
Total = Total + i
Fred
Next i
End Sub
Sub Fred()
Worksheets("Sheet2").Cells(Total, 1).Value = Worksheets("Sheet1").Cells(Total,
1).Value
End Sub
For example, when the counter is 2 the value in cell (2,1) in sheet 1 is placed
in cell (2,1) on sheet 2. When the counter is 4, the value in cell (4,1) in
sheet 1 is placed in cell (4,1). Hope this is clear. Can anyone tell me what
I am doing wrong and what I can do to fix it?
Thanks