Hi,
I have a custom formula in the excel named "=rch(ticker, NUMBER)"
"ticker" is a assigned name of the specific cell and NUMBER is just any number ex. 5432
With a press of a button on the spreadsheet, I need to populate cells D17:G17 with such formula, but with different consecutive NUMBER following the next cell in that range.
I am thinking about using a loop such that "Cells(17, cel)" and within each cell to loop "ans1 = rch & intr & rch2"
In other words, in the cell D17, I need to show "=rch(ticker,2292)"
in E17 to show "=rch(ticker,2293)"
F19 "=rch(ticker,2295)"
G19 "=rch(ticker,2296)"
I came up with such code, However, since I am a noob in VBA, I am running into troubles .
Can you please let me assist me.Sub calc2() Dim rch As String Dim rch2 As String Dim intr As Integer Dim cel As Integer Dim ans1 As String rch = "=rch(ticker," rch2 = ")" intr = 0 cel = 0 For cel = 3 To 7 Cells(17, cel).Value = ans1 For intr = 2292 To 2296 ans1 = rch & intr & rch2 Next intr Next cel End Sub
Thank you very much
Maybe I need to do it with an array?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks