View Full Version : working with strings in a formula
Hi Guys,
i am writting a basic vba code to type a formula in a cell
Range("J" & i).Value = "=VLOOKUP(A5 ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)"
However i want A5 to dynamically increase like A6, A7 etc etc
I tried using iterator i like A&i, but thats just how it types it in the cell
Some one help please
orange
12-14-2010, 03:30 PM
Sub testIterator()
Dim y As Integer
Dim s As String
For y = 5 To 8
s = "Range('J' & i).Value = '=VLOOKUP(A" & y & " ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)'"
Debug.Print s
Next
End Sub
Produces
Range('J' & i).Value = '=VLOOKUP(A5 ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)'
Range('J' & i).Value = '=VLOOKUP(A6 ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)'
Range('J' & i).Value = '=VLOOKUP(A7 ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)'
Range('J' & i).Value = '=VLOOKUP(A8 ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)'
However, I know nothing about your 'J' & i and I don't know the proper syntax for VLOOKUP
Hope this is helpful
Sub testIterator()
Dim y As Integer
Dim s As String
For y = 5 To 8
s = "Range('J' & i).Value = '=VLOOKUP(A" & y & " ,'[myList.xlsx]ReList'!$B$4:$E$39,4,)'"
Debug.Print s
Next
End Sub
Produces
However, I know nothing about your 'J' & i and I don't know the proper syntax for VLOOKUP
Hope this is helpful
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.