Forum

adding multiple cri...
 
Notifications
Clear all

adding multiple criteria for copy paste the row from one sheet to another

2 Posts
2 Users
0 Reactions
56 Views
(@saravanan)
Posts: 1
New Member
Topic starter
 

hi all ,

  i have a macro which will copy paste from one sheet to another based on one criteria i want to add one more criteria for the existing code .can anyone help me out .

the code is as follow:-

Sub AHU_Code(LogConfigurationSheet As Worksheet, iAHU_ID As Integer)
Application.ScreenUpdating = False
On Error Resume Next
Sheet23.Range("B18:E100").ClearContents
Sheet23.Range("B18:E100").ClearFormats

LogConfigurationSheet.Visible = xlSheetVisible
LogConfigurationSheet.Select

Sheet23.Range("Area_Name").Value = Replace(LogConfigurationSheet.Name, " Log Configuration", "")

Dim sFirstOccuranceRow, sLastOccuranceRow As Integer
sFirstOccuranceRow = Split(LogConfigurationSheet.Range("A:A").Find(What:=iAHU_ID, lookat:=xlWhole, searchorder:=xlByRows, SearchDirection:=xlNext).Address, "$")(2)
sLastOccuranceRow = Split(LogConfigurationSheet.Range("A:A").Find(What:=iAHU_ID, lookat:=xlWhole, searchorder:=xlByRows, SearchDirection:=xlPrevious).Address, "$")(2)

g_No_Of_parameters = sLastOccuranceRow - sFirstOccuranceRow + 1

LogConfigurationSheet.Range("B" & sFirstOccuranceRow & ":" & "E" & sLastOccuranceRow).Copy
Sheet23.Range("B18").PasteSpecial
Application.CutCopyMode = False

Call SheetFormatting.Column_Formatting_Default
Call SheetFormatting.Column_Formatting_Adjust
LogConfigurationSheet.Visible = xlSheetHidden
Application.CalculateFull
End Sub

 

(******************)

sFirstOccuranceRow = Split(LogConfigurationSheet.Range("A:A").Find(What:=iAHU_ID, lookat:=xlWhole, searchorder:=xlByRows, SearchDirection:=xlNext).Address, "$")(2)
sLastOccuranceRow = Split(LogConfigurationSheet.Range("A:A").Find(What:=iAHU_ID, lookat:=xlWhole, searchorder:=xlByRows, SearchDirection:=xlPrevious).Address, "$")(2)

 

how to added one more criteria fro example i want to search for a string along with IAHU_ID .

 

please help me out for this 

 

regards

sar

 
Posted : 08/03/2022 3:34 am
(@catalinb)
Posts: 1937
Member Admin
 

Where is that string located? Id is in column A, if the string is in column D for example, you can add a new column where you combine columns A and D, then search in the new column for: IAHU_ID & "your search string"

 
Posted : 11/03/2022 3:43 am
Share: