Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Dúvidas sobre cálculos, funções simples e aninhadas, fórmulas matriciais, etc.
Por lcbispo
Posts
#70422
Bom dia pessoal!

Meu codigo abaixo esta demorando muito para gravar, tem como melhorar o meu codigo abaixo:

Sub Gravar_Autorizacao()

Application.ScreenUpdating = False
Dim NAuto As Double
Dim DEmis As Date
Dim DReal As Date
Dim Matri As Double
Dim Nomes As String
Dim Setor As String
Dim Justi As String
Dim VCafe As Double
Dim VRefe As Double
Dim VTran As Double
Dim Total As Double
Dim Pagto As String
Dim Bcohr As String
Dim Indef As String
Dim UltimaCel As Integer

Dim QuantDados As Integer
Dim Linha As Integer

QuantDados = Sheets("Cadastro").Range("F42").End(xlUp).Row
Linha = 20
While Linha < QuantDados + 1

Sheets("Cadastro").Select
NAuto = Range("L13").Value
DEmis = Range("L14").Value
DReal = Range("L15").Value
Matri = Range("E" & Linha).Value
Nomes = Range("F" & Linha).Value
Setor = Range("G" & Linha).Value
Justi = Range("H" & Linha).Value
VCafe = Range("I" & Linha).Value
VRefe = Range("J" & Linha).Value
VTran = Range("K" & Linha).Value
Total = Range("L" & Linha).Value
Pagto = Range("K39").Value
Bcohr = Range("K40").Value
Indef = Range("K41").Value

Sheets("DadosCad").Select

UltimaCel = Range("A65000").End(xlUp).Row + 1
'UltimaCel = Range("A6000").End(xlUp).Row + 1

Range("A" & UltimaCel).Value = NAuto
Range("B" & UltimaCel).Value = DEmis
Range("C" & UltimaCel).Value = DReal
Range("D" & UltimaCel).Value = Matri
Range("E" & UltimaCel).Value = Nomes
Range("F" & UltimaCel).Value = Setor
Range("G" & UltimaCel).Value = Justi
Range("H" & UltimaCel).Value = VCafe
Range("I" & UltimaCel).Value = VRefe
Range("J" & UltimaCel).Value = VTran
Range("K" & UltimaCel).Value = Total
Range("L" & UltimaCel).Value = Pagto
Range("M" & UltimaCel).Value = Bcohr
Range("N" & UltimaCel).Value = Indef

Linha = Linha + 1
Wend

Sheets("Cadastro").Select
Range("L13").Value = Range("L13").Value + 1


Range("F20:F34").ClearContents
Range("H20:H34").Value = ""
Range("K39:K41").Value = ""
Range("L15").Value = ""
MsgBox "Gravado com sucesso"

Application.ScreenUpdating = True
End Sub

Grato.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord