MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Can't retrieve value from cell

Posted by Nate Hamilton on October 12, 2001 12:06 PM

I am selecting a range and I want the value in that cell that I pick. But what I get is the actual postion as a value. Why can't I get the value in the cell. Here is my code. Please help

For outsideCounter = 7 To 5000
Worksheets("Item Master").Select
formulaId2 = Range("J" & outsideCounter).Value

Posted by Jonathan on October 12, 2001 12:34 PM

Hmmm. I don't know. I copied your code and tried it out and it worked for me. Here's the actual code I used: I shortened the loop for my test, and I renamed a worksheet to "Item Master" and then ran this: I had all sorts of stuff in the 20 cells: formulas, text, boolean, date, numeric, and they all came through as written:

Sub OutsideCounter()

Dim OutsideCounter As Integer
Dim formulaId2

For OutsideCounter = 7 To 27 ' 5000

Worksheets("Item Master").Select
formulaId2 = Range("J" & OutsideCounter).Value

Debug.Print formulaId2

Next OutsideCounter

End Sub

So I can't say why it didn't work for you.