MrExcel Publishing
Your One Stop for Excel Tips & Solutions

cell data used in macro

Posted by Andonny on January 25, 2001 8:51 PM

I managed to get the code below to work for me.
I would like to incorporate that I can enter 9950 into cell K1 and CASHEW into cell K2 and then when I run the macro below it should look up cell K1 and K2 instead of me placing the two into the macro itself.

Just to make the above clearer I am looking to change:
If Cells(i, 7) = "9950" And Cells(i, 8) = "CASHEW" Then


If Cells(i, 7) = "Use Data from cell K1" And Cells(i, 8) = "Use Text from cell K2" Then

Thanks for your help

Thank you also to Dave Hawley and Tim Francis-Wright with my last Question.

Sub Insert_Start()
Dim i As Long, j As Long
j = Range(Range("F1"), Range("F65536").End(xlUp)).Count
For i = j To 2 Step -1
If Cells(i, 7) = "9950" And Cells(i, 8) = "CASHEW" Then
Cells(i - 1, 1) = "Start"
End If
Next i
End Sub

Posted by doug on January 26, 2001 10:11 AM

Does anyone know of a way to store a cell's value as a variable?
This would be very helpful to me if you knew how to do this?

Posted by Celia on January 26, 2001 7:14 PM

Dim cell As Range
Set cell = Range("A1")
MsgBox cell.Value