Results 1 to 2 of 2

Find value and lookup row number to use as reference

Threaded View

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2010
    Posts
    6

    Unhappy Find value and lookup row number to use as reference

    Hi,
    Ive been struggling getting a fault reporting system to work. My macro knowledge only goes as far as recording and editing code to suit.

    I have a set of spreadheets on different computers that I have a macro that copies lines of data into another excel file and distributes as required, and also into an overall 'master' sheet.

    However, I now need to be able to enter in the 'status' column when a job is completed, and copy back to the other files.

    Below is a more simple version of the spreadsheet. I want to find the status column and then look down this to find the 'closed' jobs, then look for the 'fault' number. This 'fault' number matches another spreasheet, so the row needs to be copied and paste over the corresponding row. I need to loop this down the wole status column until I reach the bottom and repeat for the 'in prog' jobs too

    fault test type status date comment
    1 1 water open
    2 3 water open
    3 2 electrical closed
    4 1 hardware open
    5 1 software in prog
    6 1 hardware open


    This is what i started with but im aware its mostly rubbish
    Sub Macro1()
    '
    ' Macro1 Macro
    '
    Dim FaultID As Integer
    Dim i As Integer
    'Dim lastrow As Long
    Dim StatusColumn As Integer
    i = 1
    
    ' Turn off screenupdates and determine course of action on error:
        Application.ScreenUpdating = False
        Sheets("Overall").Activate
    'Find "status" column number and Determine if change has been made to faults
        Range("A1:f20").Select
        Selection.Find(What:="Status", After:=ActiveCell, LookIn:=xlValues, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=True, SearchFormat:=False).Activate
            
        StatusColumn = ActiveCell.Column
        i = i + 1
        
        Do While RowCount
        For i = 1 To 5000
    'when rowcount not = spaces and <5000
    
        Range("statuscolumn").Select
        Selection.Find(What:="closed", After:=ActiveCell, LookIn:=xlValues, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate
    
    .....etc
    End sub
    I hope this is clear, really appreciate any help as you can see im not getting very far
    Last edited by Cutter; 08-10-2012 at 09:00 AM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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