Macro's are a simple way to make things happen in Excel
In the sheet I will explain some macro examples
'Macro to copy info to another place.
Sub copycell()
'Mention the worksheet and cell of info you want to copy.
Worksheets("Name worksheet").Range("Cell name").Copy
'Mention the worksheet and cell you want to copy to.
Worksheets("Name worksheet").Range("Cell name").PasteSpecial xlPasteValues
Worksheets("Name worksheet").Range("Cell name").PasteSpecial xlPasteSpecial xlPasteFormats
Worksheets("Name worksheet").Range("Cell name").PasteSpecial xlPasteValidation
Worksheets("Name worksheet").Range("Cell name").PasteSpecial xlPasteFormulasAndNumberFormats
‘Macro with functions: If, And, Left and Right
Sub If()
If WorksheetFunction.And(Left(Worksheets("Sheet name").Range("Cell name"), 1) = "First letter left to look for ", Right(Worksheets("Sheet name").Range("Cell name"), 1) = "first letter right to look for") Then
Worksheets("Sheet name").Range("A1") = 5
End If
End Sub
‘Sheet name can also be a text in a cell, for example in cell A1 in Worksheet Sheet1
‘then ("Sheet name") = (Worksheets("Sheet name").Range("Cell name").Text) = (Worksheets("Sheet1").Range("A1").Text)
‘Macro with functions: Index and Match.
Sub with()
With Worksheets(“Name of worksheet”)
Application.WorksheetFunction.Index(.Range("Range of Cell in block"), WorksheetFunction.Match("Text to look for", Sheets(Worksheets("workbook name").Range("Cell name").Text).Range("Range of Cell in Row"), 0) + 9, 9).PasteSpecial xlPasteValues
End With
End Sub
Maak jouw eigen website met JouwWeb