AAP
Member
Hello Friends, need help to set a variable with if condition.
The below code I need to copy with every worksheet and I have more than 100 sheets in a workbook, so I think to make this below condition as variable. So that instead of copying and pasting whole code I can write just a word called "Checking". Thanks
[If Range("A2").Value <> "" Then
If Range("A3").Value = "" Then
Range("A2:G2").Select
Selection.Copy
Else
Range("A2:G2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End If
Workbooks("Siba Macro.xlsm").Worksheets("Data").Activate
Range("A2").Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select
Selection.PasteSpecial xlPasteValues
End If]
The below code I need to copy with every worksheet and I have more than 100 sheets in a workbook, so I think to make this below condition as variable. So that instead of copying and pasting whole code I can write just a word called "Checking". Thanks
[If Range("A2").Value <> "" Then
If Range("A3").Value = "" Then
Range("A2:G2").Select
Selection.Copy
Else
Range("A2:G2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End If
Workbooks("Siba Macro.xlsm").Worksheets("Data").Activate
Range("A2").Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select
Selection.PasteSpecial xlPasteValues
End If]