+ Reply to Thread
Results 1 to 5 of 5

VBA code to find a cell

  1. #1
    Registered User
    Join Date
    07-17-2008
    Location
    USA
    Posts
    2

    VBA code to find a cell

    Dear All,

    I am stuck with a problem!!
    I want some help regarding the following situation:
    I need to find a cell in the worksheet with a specified string, then go two steps rightwards to another cell and put a specified integer value in that cell.
    The search range is actually a date string that can be found in different rows of column A only.
    I need to do this entirely in VBA only
    Any help regarding this will be highly appreciated!!!

    Thanks!!!

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Use the VBA Find function. The example in the VBA Help files is straight forward, or search the forum for FIND
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Are you sure it is a date string that you are looking for and not the actual date which is a number? Date formats make the numbers appear as strings.

    Here is one method. Of course the Find routine is the most efficient.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-17-2008
    Location
    USA
    Posts
    2

    Need help for navigating through cells

    Hi,

    I have the following code snippet:

    Please Login or Register  to view this content.
    Here I am able to get the return value of the FoundCell as "$A$329" which is correct.
    Now my goal is to move two cells rightways and then plug a specified integer value in that particular cell.
    I need to know how to move two cells rightward so that I can get hold of the target cell.

    Your help will be highly appreciated.
    Thanks!!

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello ,

    This macro will set the cell 2 columns to the right of the found cell to the integer variable N. This macro format uses late binding. This is typically run from another application other than Excel to manipulate a workbook. If this macro is being run from Excel then the macro should be change for better maintainability and efficiency.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ 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