Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have some search coding I am using to create a summary sheet at the back
of a workbook. When the search criteria is met the entire row will e copied over to the summary tab. What I need to do is also copy the sheet name with that data so I know exactly where it came from. I don't have a clue how to do this, can anyone guide me please. CODING: Option Explicit Option Compare Text Sub SeachSheets() ' Dim FirstAddress As String, WhatFor As String Dim Cell As Range, Sheet As Worksheet ' WhatFor = InputBox("What are you looking for?", "Search Criteria") If WhatFor = Empty Then Exit Sub ' For Each Sheet In Sheets If Sheet.Name < "SUMMARY" Then With Sheet.Columns(6) Set Cell = .Find(WhatFor, LookIn:=xlValues, LookAt:=xlPart) Set Cell = .Find(WhatFor, LookIn:=xlValues, LookAt:=xlWhole) If Not Cell Is Nothing Then FirstAddress = Cell.Address Do Cell.EntireRow.Copy _ Destination:=Sheets("SUMMARY").Range("A" & Rows.Count).End(xlUp).Offset(1, 0) Set Cell = .FindNext(Cell) Loop Until Cell Is Nothing Or Cell.Address = FirstAddress End If End With End If Next Sheet ' Set Cell = Nothing End Sub Sub Clear() Range("A4:K50").Select Selection.ClearContents Range("J18").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy rows from one Data sheet to another sheet based on cell conte | Excel Discussion (Misc queries) | |||
copy data of two cells from Sheet 2 into one cell in Sheet 1 | Excel Worksheet Functions | |||
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. | Excel Programming | |||
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 | Excel Worksheet Functions | |||
Active Cell Copy And Paste Sheet to Sheet | New Users to Excel |