Doubt last line in VBA

Asked

Viewed 30 times

0

Hello, I’m writing the following code.

Sub DINAMICO()
    
Dim LINHA As Byte, PREENCHIMENTO As String, PREENCHIMENTOTWO As Currency, PREENCHIMENTOTRES As String

*Range("A1") = "PRODUTO"
Range("B1") = "VALOR"
Range("C1") = "SOBRENOME"
Range("A2") = "-"
Range("B2") = "-"
Range("C2") = "-"*

LINHA = Range("A1").End(xlDown).Row + 1
    
PREENCHIMENTO = InputBox("NOME")
PREENCHIMENTOTWO = InputBox("VALOR")
PREENCHIMENTOTRES = InputBox("SOBRENOME")

Range("A" & LINHA) = PREENCHIMENTO
Range("B" & LINHA) = PREENCHIMENTOTWO
Range("C" & LINHA) = PREENCHIMENTOTRES

End Sub

However, if I take the part that is in italics that in the case is the first line that would be the title of what I am writing along with the first line the macro does not rotate

  • Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of it. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in English (short version). If the solution is very simple it is still possible for someone to do so in the comments.

1 answer

0

In this case the results are correct.

If you take the first line - Sub DINAMICO() - You’re taking the signature off the function, which is what it tells the language where the code starts. No signature function works, in no programming language.

And if I understand correctly, the other line you’re removing is Dim LINHA As Byte, PREENCHIMENTO As String, PREENCHIMENTOTWO As Currency, PREENCHIMENTOTRES As String which is the variable declaration. Again, without it it is expected that your code will not work.

Looks like you need to pick up some basic cocneitos on programming. Take a look in this video

Browser other questions tagged

You are not signed in. Login or sign up in order to post.