+ Reply to Thread
Results 1 to 5 of 5

Finding a value and placing text on the cell to the right

  1. #1
    Reggie
    Guest

    Finding a value and placing text on the cell to the right

    I am searching down a column for a particular value and if found, I want to
    check the cell to the immediate right to see if its empty. If it is, I want
    to
    insert a text value. If the cell to the right has a value already in it, I
    want to move to the next available empty space to the right and put in
    value. Any help would be greatly appreciated.

  2. #2
    Tom Ogilvy
    Guest

    Re: Finding a value and placing text on the cell to the right

    Sub SearchingdownTheSelection()
    for each cell in selection
    if cell.Value = "particular" then
    set cell1 = cells(cell.row,256).End(xltoLeft)(1,2)
    cell1.Value = "text"
    end if
    Next
    End Sub

    replace selection with a specific range if you wish

    for each cell in Range("B2:B200")

    as an example.

    --
    Regards,
    Tom Ogilvy

    "Reggie" <[email protected]> wrote in message
    news:[email protected]...
    > I am searching down a column for a particular value and if found, I want

    to
    > check the cell to the immediate right to see if its empty. If it is, I

    want
    > to
    > insert a text value. If the cell to the right has a value already in it, I
    > want to move to the next available empty space to the right and put in
    > value. Any help would be greatly appreciated.




  3. #3
    Reggie
    Guest

    Re: Finding a value and placing text on the cell to the right

    Thanks Tom for the quick response. I have another question. what if I wanted
    to search another sheet to find a particular value? for example

    On sheet1 I enter a value and I want to find that value on sheet2 and then
    basically see if the cell to the right is empty if so put in a value. If its
    not empty move another space to right and put in a value. Sorry I didn't
    clarify this before.


    "Tom Ogilvy" wrote:

    > Sub SearchingdownTheSelection()
    > for each cell in selection
    > if cell.Value = "particular" then
    > set cell1 = cells(cell.row,256).End(xltoLeft)(1,2)
    > cell1.Value = "text"
    > end if
    > Next
    > End Sub
    >
    > replace selection with a specific range if you wish
    >
    > for each cell in Range("B2:B200")
    >
    > as an example.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Reggie" <[email protected]> wrote in message
    > news:[email protected]...
    > > I am searching down a column for a particular value and if found, I want

    > to
    > > check the cell to the immediate right to see if its empty. If it is, I

    > want
    > > to
    > > insert a text value. If the cell to the right has a value already in it, I
    > > want to move to the next available empty space to the right and put in
    > > value. Any help would be greatly appreciated.

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Finding a value and placing text on the cell to the right

    Sub Searching()
    Dim cell as Range, v as Variant, cell1 as Range
    v = lcase(Worksheets("Sheet1").Range("a1").Value)
    with Worksheets("Sheet2")
    for each cell in .Range("B2:B30")
    if lcase(cell.Value) = v then
    set cell1 = .cells(cell.row,256).End(xltoLeft)(1,2)
    cell1.Value = "text"
    end if
    Next
    End With
    End Sub

    --
    Regards,
    Tom Ogilvy



    "Reggie" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks Tom for the quick response. I have another question. what if I

    wanted
    > to search another sheet to find a particular value? for example
    >
    > On sheet1 I enter a value and I want to find that value on sheet2 and then
    > basically see if the cell to the right is empty if so put in a value. If

    its
    > not empty move another space to right and put in a value. Sorry I didn't
    > clarify this before.
    >
    >
    > "Tom Ogilvy" wrote:
    >
    > > Sub SearchingdownTheSelection()
    > > for each cell in selection
    > > if cell.Value = "particular" then
    > > set cell1 = cells(cell.row,256).End(xltoLeft)(1,2)
    > > cell1.Value = "text"
    > > end if
    > > Next
    > > End Sub
    > >
    > > replace selection with a specific range if you wish
    > >
    > > for each cell in Range("B2:B200")
    > >
    > > as an example.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Reggie" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I am searching down a column for a particular value and if found, I

    want
    > > to
    > > > check the cell to the immediate right to see if its empty. If it is, I

    > > want
    > > > to
    > > > insert a text value. If the cell to the right has a value already in

    it, I
    > > > want to move to the next available empty space to the right and put

    in
    > > > value. Any help would be greatly appreciated.

    > >
    > >
    > >




  5. #5
    Reggie
    Guest

    Re: Finding a value and placing text on the cell to the right

    Thanks Tom! it works perfectly

    "Tom Ogilvy" wrote:

    > Sub Searching()
    > Dim cell as Range, v as Variant, cell1 as Range
    > v = lcase(Worksheets("Sheet1").Range("a1").Value)
    > with Worksheets("Sheet2")
    > for each cell in .Range("B2:B30")
    > if lcase(cell.Value) = v then
    > set cell1 = .cells(cell.row,256).End(xltoLeft)(1,2)
    > cell1.Value = "text"
    > end if
    > Next
    > End With
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    >
    > "Reggie" <[email protected]> wrote in message
    > news:[email protected]...
    > > Thanks Tom for the quick response. I have another question. what if I

    > wanted
    > > to search another sheet to find a particular value? for example
    > >
    > > On sheet1 I enter a value and I want to find that value on sheet2 and then
    > > basically see if the cell to the right is empty if so put in a value. If

    > its
    > > not empty move another space to right and put in a value. Sorry I didn't
    > > clarify this before.
    > >
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > Sub SearchingdownTheSelection()
    > > > for each cell in selection
    > > > if cell.Value = "particular" then
    > > > set cell1 = cells(cell.row,256).End(xltoLeft)(1,2)
    > > > cell1.Value = "text"
    > > > end if
    > > > Next
    > > > End Sub
    > > >
    > > > replace selection with a specific range if you wish
    > > >
    > > > for each cell in Range("B2:B200")
    > > >
    > > > as an example.
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > > "Reggie" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > I am searching down a column for a particular value and if found, I

    > want
    > > > to
    > > > > check the cell to the immediate right to see if its empty. If it is, I
    > > > want
    > > > > to
    > > > > insert a text value. If the cell to the right has a value already in

    > it, I
    > > > > want to move to the next available empty space to the right and put

    > in
    > > > > value. Any help would be greatly appreciated.
    > > >
    > > >
    > > >

    >
    >
    >


+ Reply to Thread

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