Hello,
I have the following VBA code which pastes information from one worksheet to another worksheet based on defined criteria. The two worksheets have different headings, and I need the information to paste according to the headings. How do I modify this code in order for that to happen?
Sub Awarded()
Dim fCell As Range
Dim wsSearch As Worksheet
Dim wsDest As Worksheet
'What sheet are we searching?
Set wsSearch = Worksheets("SALES FUNNEL")
'Where should we move the data?
Set wsDest = Worksheets("AWARDED")
'Prevent screen flicker
Application.ScreenUpdating = False
'We will be searching col I
With wsSearch.Range("I:I")
'Find the word "Awarded"
Set fCell = .Find(what:="Awarded", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
'Repeat until we've moved all the records
Do Until fCell Is Nothing
'Found something, copy and delete
fCell.EntireRow.Copy Destination:=wsDest.Cells(.Rows.Count, "A").End(xlUp).Offset(1)
fCell.EntireRow.Delete
'Try to find next one
Set fCell = .Find(what:="Awarded", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
Loop
End With
'Reset
Application.ScreenUpdating = True
End Sub
I have the following VBA code which pastes information from one worksheet to another worksheet based on defined criteria. The two worksheets have different headings, and I need the information to paste according to the headings. How do I modify this code in order for that to happen?
Sub Awarded()
Dim fCell As Range
Dim wsSearch As Worksheet
Dim wsDest As Worksheet
'What sheet are we searching?
Set wsSearch = Worksheets("SALES FUNNEL")
'Where should we move the data?
Set wsDest = Worksheets("AWARDED")
'Prevent screen flicker
Application.ScreenUpdating = False
'We will be searching col I
With wsSearch.Range("I:I")
'Find the word "Awarded"
Set fCell = .Find(what:="Awarded", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
'Repeat until we've moved all the records
Do Until fCell Is Nothing
'Found something, copy and delete
fCell.EntireRow.Copy Destination:=wsDest.Cells(.Rows.Count, "A").End(xlUp).Offset(1)
fCell.EntireRow.Delete
'Try to find next one
Set fCell = .Find(what:="Awarded", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
Loop
End With
'Reset
Application.ScreenUpdating = True
End Sub