How to assign the formula of cell D2 in a variable?

1

CODE:

Range("AB2").Select
Dim tudo As String  
data_pasta = Format(Date, "/yy/mm/")

tudo = "https://pagina.pt/wp-content/imagens" & data_pasta & **D2** ".png"

ActiveCell.Value = tudo
ultima_linha = Range("A" & Rows.Count).End(xlUp).Row
Range("AB2").AutoFill Destination:=Range("AB2:AB" & ultima_linha)

EXAMPLE: https://pagina.pt/wp-content/imagens/17/31/ 1234122 .png

    
asked by anonymous 31.05.2017 / 17:36

2 answers

0

To get the value of the cell A2 use Range("A2").Value . You can replace your text ** A2 ** with this, but do not forget to put & before ".png" .

    
31.05.2017 / 20:04
0

ANSWER: .Value

Range("AC2").Select
Dim tudo As String
data_pasta = Format(Date, "/yy/mm/")
tudo = "https://www.pagina.pt/wp-content/imagens" & data_pasta & Range("D2").Value & ".png"
ActiveCell.Value = tudo
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("AC2").AutoFill Destination:=Range("AC2:AC" & Lastrow)
    
31.05.2017 / 21:08