0
Good evening guys, I created a folder with macro where I have two spreadsheets, Query and games. In the spreadsheet games I put name of games and their respective values in real, already in the query I created a list to make the autocomplete with combo box using the PROCV.
So what I’m trying to do, get the value of a cell that, gets its value from the combo box and copies it to another cell that by doing this, the selection of the cell goes down, so as soon as I go and select another game, it will re-copy the value of that cell to the new.
I’ve managed to get the value and throw it in the other cell, but I don’t know how to make the selection go to the bottom cell, I’ve already researched and tried to use the Application.Sendkeys "{ENTER}" but it didn’t work, I thought to use For each and managed to jump the line, but after that I couldn’t make a way to get the value again.
Follow the code below.
Sub teste()
Dim exame As String
Dim valor As Double
Dim limite, celula As Range
Set limite = Range("F2:F50")
For Each celula In limite.Offset(0, 5)
If Range("E4").Value <> "" Then
exame = Range("E4").Value
valor = Range("D5").Value
Range("F2").Value = exame
Range("G2").Value = valor
End If
Next
End Sub
Please create a [mcve] with example of the data you want to do this. You can create a table and what errors occur? And for better readability, the indentation can be performed.
– danieltakeshi
So Daniel Takeshi, ignoring For Each, in IF I take the value inside E4, which will be different from empty, I play the values of cells E4 and D5 and the games in the respective variables, exam and value, then they will be moved to cells F2 and G2. I thought that using For Each, and putting the Application.Sendkeys "{ENTER}", would cause when picking the values, the cursor would go to the cell below, so picking up more values and placing them as a stack, bored?
– Itay Sena
Could you edit the question with this information and some test data? to illustrate, it can be by image
– danieltakeshi
So, if I use the Sendkeys {"ENTER"} it gives enter in the code and not in the spreadsheet. https://uploaddeimagens.com.br/imagens/1-png-4439d924-b98a-4449-8232-b930f57b0364 https://uploaddeimagens.com.br/imagens/2-png-09646f65-d78b-4820-83b7-225fb637b33d
– Itay Sena