Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm running a vbscript in excel.
But i keep running into
Run-time error '13':
Type mismatchat line
If Cells(i, 2).Value = "#N/A" Then Cells(i, 2).Value = Cells(i - 1, 2).ValueAny1 have any idea how to settle this problem?
Sub Test()
Sheets("Sheet1").Select
Range("A2").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
'Column A
For i = 1 To 1000
Cells(i, 1) = Range("A1").Value + i - 1
Next i
'Column B
Worksheets("Sheet2").Range("B1:B1000").Formula = "=VLOOKUP(Sheet2!A1,Sheet1!A:A,1,False)"
'Replace #N/A value with value above
For i = 1 To 1000
If Cells(i, 2).Value = "#N/A" Then Cells(i, 2).Value = Cells(i - 1, 2).Value
Next iEnd Sub

![]() |
bat script (simple)
|
how do you delete system ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |