MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

wondering if I could get some macro/vba help

  Asked By: Almas    Date: Nov 07    Category: MS Office    Views: 765

I have named cell BOB and named cell TOM. They each have numeric
values. I want to write a macro that does this:

if BOB does not equal TOM
then copy TOM and paste into BOB

Anybody know how to write this? My main problem is I can't figure out
how to refer to a named cell using VBA script. Yes I'm new to the
whole macro programming thing :)



2 Answers Found

Answer #1    Answered By: Jawna Mohammad     Answered On: Nov 07

Named cells are range names, use Range (). E.g.

If Range("BOB").Value <> Range("TOM").Value Then
Range("BOB").Value = Range("TOM").Value

No need for copy/paste.

Answer #2    Answered By: Venkat Rulez     Answered On: Nov 07

Thank you. That worked great for me.

Didn't find what you were looking for? Find more on wondering if I could get some macro/vba help Or get search suggestion and latest updates.