View Single Post
  #2   Report Post  
KeriM KeriM is offline
Member
 
Posts: 70
Default

Quote:
Originally Posted by KeriM View Post
I'm trying to assign a cell value to a variable, and I keep getting a "Run-Time error '1004': Application-defined or object defined error"

I have a column number, 60, assigned to a variable called "DropDown_txt"
I have a row value assigned to a variable called "i"
I would like to assign the value in that cell reference to a variable.

Here is my code that is giving me the above mentioned error:

Code:
 ComboVal = Sheets("DATA").Cells(i,DropDown_txt).value
I've also tried it this way with the same resulting error:

Code:
 ComboVal = Sheets("DATA").Cells(i, 60).value
For some reason, this works with no error:

Code:
 ComboVal = Sheets("DATA").Cells(i, "BH").value
Does anyone have any suggestions as to why this is happening?
I solved my own problem. I had declared "DropDown_Txt" as a String. When I declared it as an Integer, that fixed the problem.

Last edited by KeriM : November 22nd 13 at 06:47 PM