Find a value in a column, then from that point find the first of another value in that same column and paste a value 20 columns to the right of that v

sdoppke

Well-known Member
Joined
Jun 10, 2010
Messages
647
Well although long, the titel sais it all. I am hoping to get help with a Macro to find a value in a column (a number) then find the matching name (Bob) in that same column, below that number (will be withing 29 rows of that number) and then paste a value 20 columns to the right of the found name (Bob).

Well sounds easy, but im sure its not.

Thanks in advance for any help. :)

sd
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Well although long, the titel sais it all. I am hoping to get help with a Macro to find a value in a column (a number) then find the matching name (Bob) in that same column, below that number (will be withing 29 rows of that number) and then paste a value 20 columns to the right of the found name (Bob).

Well sounds easy, but im sure its not.

Thanks in advance for any help. :)

sd


I figures this out :) Imhoping to get further help with this though.
The sheet2 is so large (1100 + rows), I have much it hidden at different time to help the viewer. With that said, it seems as though my "find" task is not able to find the item, if it is in the hidden portion of the sheet. Is there a way to get around that without unhidding everything?

Here is the complete Sub:

Code:
Sub Input_Availability()
Application.ScreenUpdating = False
findvalue = Sheets("MyStoreInfo").ComboBox1.Value
If Sheets("MyStoreInfo").CheckBox1.Value = True Then
Box = "O"
End If
If Sheets("MyStoreInfo").CheckBox2.Value = True Then
Box = "P"
End If
If Sheets("MyStoreInfo").CheckBox3.Value = True Then
Box = "R"
End If
    On Error GoTo finish
    Range("Q10:AD49").Select
   Selection.Find(What:=findvalue, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True _
        , SearchFormat:=False).Activate
    On Error GoTo 0
    RowNum = ActiveCell.row
    ColNum = ActiveCell.Column
    
    For r = 1 To 7
        If Cells(RowNum + r, ColNum) = "" Then
            Cells(RowNum + r, ColNum) = Range("B10") & " " & Range("C10")
            Cells(RowNum + r, ColNum + 1) = Box
            
'begin part that inputs the letter to Schedule Template
FindName = Sheets("MyStoreInfo").Range("B10") & " " & Sheets("MyStoreInfo").Range("C10")
FindNumber = Sheets("MyStoreInfo").ComboBox1.Value
If Sheets("MyStoreInfo").CheckBox1.Value = True Then
Box = "O"
End If
If Sheets("MyStoreInfo").CheckBox2.Value = True Then
Box = "P"
End If
If Sheets("MyStoreInfo").CheckBox3.Value = True Then
Box = "R"
End If
Sheets("Schedule Tool").Visible = True
Sheets("Schedule Tool").Select
    Columns("A:A").Select
    Range("A3").Activate
    On Error GoTo 0
    Selection.Find(What:=FindNumber, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
        xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False).Activate
    Selection.FindNext(After:=ActiveCell).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Find(What:=FindName, After:=ActiveCell, LookIn:= _
        xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Select
        
    RowNum = ActiveCell.row
    ColNum = ActiveCell.Column
    Cells(RowNum, ColNum + 88) = Box
    Sheets("Schedule Tool").Visible = False
'end part that inputs the letter to Schedule Template
            Sheets("MyStoreInfo").Select
            Range("Q8").Select
            Application.ScreenUpdating = True
            Exit Sub
            
        Else
            If r = 7 Then
                Application.ScreenUpdating = True
                MsgBox ("No more room")
                Exit Sub
            End If
            
        End If
    Next
finish:
    Err.Clear
    MsgBox ("Date not found")
End Sub

Thanks in advacne for any help.

sd
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top