CharlieG
12-20-2019, 08:15 AM
Hi everyone,
forgive such a basic question but this is the first time have been confronted by VBA and need to demonstrate to colleagues that even simple modules can help!
have the following code:
Sub CgSign()
'
' CgSign Macro
'
' Keyboard Shortcut: Ctrl+Shift+C
'
If ThisWorkbook.ActiveSheet = 2 Then
ActiveSheet.Pictures.Insert("C:\Users\charlieg\Documents\cg signature.tif"). _
Select
Selection.ShapeRange.ScaleWidth 0.4, msoFalse, msoScaleFromBottomRight
Selection.ShapeRange.ScaleHeight 0.4, msoFalse, msoScaleFromTopLeft
Selection.Left = ActiveSheet.Range("R4").Left + 10
Selection.Top = ActiveSheet.Range("R4").Top + 10
'End If
End Sub
Workbook has 2 sheets - "Contract review" and "Jobcard review"
have got the code sorted to get the image into the correct place on the Jobcard review sheet but need the code to first check which sheet is active and then determine whether to use the code for the jobcard sheet or to switch to a code section to apply it to the contract review sheet instead.
Please could anyone correct the IF statement in the code as it errors and am way too new to have got to grips with details beyond recording a simple macro!
thank you!!
forgive such a basic question but this is the first time have been confronted by VBA and need to demonstrate to colleagues that even simple modules can help!
have the following code:
Sub CgSign()
'
' CgSign Macro
'
' Keyboard Shortcut: Ctrl+Shift+C
'
If ThisWorkbook.ActiveSheet = 2 Then
ActiveSheet.Pictures.Insert("C:\Users\charlieg\Documents\cg signature.tif"). _
Select
Selection.ShapeRange.ScaleWidth 0.4, msoFalse, msoScaleFromBottomRight
Selection.ShapeRange.ScaleHeight 0.4, msoFalse, msoScaleFromTopLeft
Selection.Left = ActiveSheet.Range("R4").Left + 10
Selection.Top = ActiveSheet.Range("R4").Top + 10
'End If
End Sub
Workbook has 2 sheets - "Contract review" and "Jobcard review"
have got the code sorted to get the image into the correct place on the Jobcard review sheet but need the code to first check which sheet is active and then determine whether to use the code for the jobcard sheet or to switch to a code section to apply it to the contract review sheet instead.
Please could anyone correct the IF statement in the code as it errors and am way too new to have got to grips with details beyond recording a simple macro!
thank you!!