You need some Variables (memory variable) http://www.excel-vba.com/excel-vba-contents.htm
Sub Test() '--declaring variable Dim MyCell As Range Dim MyValue As Variant Dim CompareResult as Boolean '--assignments Set MyCell = Range("A1") MyValue = MyCell.Value '--copying the value to another cell Range("T4").Value = MyValue '--comparaing two thing (in same Type) '--you can compare two values by one of the Comparison Operators : ' = / > / < / >= / <= / <> / Like ' http://www.excelfunctions.net/VBA-Operators-And-Functions.html ' http://sourcedaddy.com/ms-excel/working-with-vba-operators.html CompareResult = (Range("T4").Value* = *MyCell.Value) MsgBox CompareResult or in another expression If Range("T4").Value *=* MyCell.Value Then MsgBox "Equal" Else MsgBox "Not Equal" End If End Sub hope it helps CMIIW On Mon, Jun 27, 2011 at 10:10 PM, Andrew <nordies_1...@yahoo.com> wrote: > I am new to VBA and would like to ask everyone a question about how to > capture an object? > > I want to copy a value and position in excel. For example: > > 1 - Find cell A1 and get the contents, "code1234" and remember that > position > 2 - I want to copy the contents to cell T4 > 3 - Go back to cell position A1 and compare it to the value of cell A2 > > So i think my problem right now being a newbie at this is that i can > record the actions using the recorder and can copy and paste a cell by > referring to it as say, Range("F48").Select.... > But if i want to know the value of the F48 cell i am not sure how to > do that after i have copied that cell? > > Also how do you compare the value of cells? For example i want to > compare cells, A1 and A2? > > Andrew > > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel