Results 1 to 9 of 9

Search cell

Threaded View

  1. #1
    Registered User
    Join Date
    05-20-2010
    Location
    Green Bay
    MS-Off Ver
    Excel 2007
    Posts
    20

    Search cell

    I have a macro that I am trying to get something done. I want it to search a range of cells from E2:P13. If it contains a "1" then copy cell B27 to that cell and repeat for all cells in that range. If it contains a "2" then copy cell C27 to that cell.

    I had a VB class in college and wrote this, but I would have to copy and paste it for each cell and if I add a row it would not be easy to change.

    If Range("E2").Value = "1" Then
            Range("B27").Select
            Selection.Copy
            Range("E2").Select
            ActiveSheet.Paste
            Application.CutCopyMode = False
        ElseIf Range("E2").Value = "2" Then
            Range("C27").Select
            Selection.Copy
            Range("E2").Select
            ActiveSheet.Paste
            Application.CutCopyMode = False
        End If
    Can anyone help with something more "dynamic"?

    Thanks!
    Last edited by esullivan; 05-20-2010 at 11:23 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1