B
B
beduin012015-12-22 11:34:18
Macros
beduin01, 2015-12-22 11:34:18

How to fix this error in Excel?

This error is thrown. As I understand it, he does not like the type. Do not tell me how to fix it?
56790ab9af55f.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Fedoryan, 2015-12-22
@AnnTHony

Works. Dim j As Integer

Sub ololo()
    Sheets("List").Select
    Dim j As Integer
    j = 1
    Do Until Range("A" & j) = ""
        Range("B" & j) = CDate(Range("A" & j)) + 14
        Range("C" & j) = CDate(Range("A" & j)) + 21
        j = j + 1
    Loop
End Sub

With error handling:
Sub ololo()
On Error GoTo WTF
    Sheets("List").Select
    Dim j As Integer
    j = 1
    Do Until Range("A" & j) = ""
        Range("B" & j) = CDate(Range("A" & j)) + 14
        Range("C" & j) = CDate(Range("A" & j)) + 21
        j = j + 1
    Loop
    MsgBox ("No errors! Success!")
    GoTo StopThisShit:
WTF:
    MsgBox ("ololo!!! Error there: " & Str(j))
    Range("B" & j) = "ololo"
    Range("C" & j) = "ololo"
    Resume Next
StopThisShit:
End Sub

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question