+ Reply to Thread
Results 1 to 1 of 1

color coded or values cell search and copy

Hybrid View

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    Spain
    MS-Off Ver
    Excel 2010
    Posts
    3

    color coded or values cell search and copy

    Hi everyone,

    im trying to search with a list of values in a range that when ever a value is found, i need to offset that cell found and from the offset, resize, add to a range then with the value that was searched, past to the worksheet that has the same value in a specific cell (this cell will be the same for all the values)

    Lets say i have these Sheets
    Lista Horarios (This in the Data File)
    January (Enero in spanish)
    February (Febrero in spanish)
    ...
    ..

    In Data i have a range of 24 columns of data that every 4 rows the format is the same with different values, Colum AC to search in and Colum AF with the values to search with (January, February,...)

    I need to jump through each search value, selecting each one found, offsetting to a point in the 24 columns of data and resizing the selection.
    After selection is done, add the range to a declared range.

    Then ill need to jump to the sheet of the value that was searched, for example January and past in January, cell B4 the Range that was acquired from the Data sheet.

    When done, jump to the next value and search. and so on.

    If it’s easier, i have color coded each month that will be searched.
    Each month with a different color.

    Ill attach a document so you can see what i intend to do.

    You might find something in spanish in the excel sheets.

    I'll appreciate all the help i can get.

    *****************
    EDIT
    *****************
    Iv figured out this much but there is some code that im missing and doing wrong.

    Any ideas to what im doing wrong???

    Please help

    Sub Update_CP()
    '
    ' Select_move Macro
    '
    
    Dim v1Fecha, v2Fecha, vTotal As String
    Dim s1Fecha, s2Fecha, rTotal, Found, rr As Range
    Dim rFirstAddress
    
    ''''''Declaraciones
    
    strFileMio = Range("I4") 'Nuestra plantilla
    
    
    Set s1Fecha = Workbooks(strFileMio).Sheets("Lista Horarios").Range("AF13")
    v1Fecha = s1Fecha.Value
    
    Set s2Fecha = Workbooks(strFileMio).Sheets("Lista Horarios").Range("AF26")
    v2Fecha = s2Fecha.Value
    
    '''''''CODE''''''
    
    
    
    Do Until v1Fecha = ""
    
    
    Sheets("Lista Horarios").Activate
    
    Range("AC11").Activate
    
    
        Set Found = [AC11:AC213].Find(What:=v1Fecha, After:=ActiveCell, LookIn:=xlValues, _
          LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
          MatchCase:=False, SearchFormat:=False)           
            
            
        If Not Found Is Nothing Then
         
            rFirstAddress = Found.Address
           
            Do Until Found Is Nothing
                With Found
    
                    .Activate
                    Set rr = ActiveCell.Offset(0, -28).Resize(4, 24)
                    
                    If Not rTotal Is Nothing Then
                        
                        Set rTotal = Application.Union(rTotal, rr)
                        Else
                        Set rTotal = rr
                        
                        
                    End If
    
    
                    Set Found = [AC11:AC231].FindNext(Found)
    
    
                    
                        If Found.Address = rFirstAddress Then
                    
                            Application.CutCopyMode = False
                            rTotal.Select
                            Selection.Copy
                            Sheets(v2Fecha).Range("B4").Paste
                            
                            Exit Do
                        
                        End If
                    
                End With
                
            Loop
            
        End If
    
    
    
        Set s1Fecha = s1Fecha.Offset(1, 0)
        v1Fecha = s1Fecha.Value
        
        Set s2Fecha = s2Fecha.Offset(1, 0)
        v2Fecha = s2Fecha.Value
        
        rTotal = ""
        'vTotal = rTotal.Value
        
    Loop
    
    
    End Sub
    Fore some reason i had to Zip the .xls document. Its not over 1MB
    Attached Files Attached Files
    Last edited by Macrodroid; 11-22-2011 at 04:14 AM. Reason: SOLVED and no help ¬¬

+ 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