Good morning,
I'm looking to print the active worksheet if cell C2 value in the active sheet has a value of 1
Can anyone help with this?
Thanks in advance
Good morning,
I'm looking to print the active worksheet if cell C2 value in the active sheet has a value of 1
Can anyone help with this?
Thanks in advance
Try this:
![]()
Sub ams() Dim x As Range Set x = Range("C2") If x = 1 Then Application.ActiveSheet.PrintOut End If End Sub
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
This example makes sense and I agree, should work. When I type a 1 in cell C2 and press enter, nothing happens
This runs off a macro. Select Alt +F8 to see your macros. Select ams. You could link this to a command button, but If you want this to run when you change the value in C2, then you must load the vba in a worksheet change event.
Here's what I have, What am I doing wrong.
I can get this to work by running the macro, but not by entering a 1 in cell C2.
In workbook code I have. . .
End Sub![]()
Private Sub Worksheet_Calculate() On Error Resume Next If [c2] = 1 Then Application.Run "sheet1.ams" End If
In sheet1 code I have. . .
![]()
Sub ams() Application.ActiveSheet.PrintOut End If End Sub
Got it, thank you for your help.
![]()
Private Sub Worksheet_Change() On Error Resume Next If [c2] = 1 Then Application.Run "sheet1.ams" End If End Sub
Sorry,
This was the code I used . . .
![]()
Private Sub Worksheet_Change(ByVal Target As Range) Dim x As Range Set x = Range("C2") If x = 1 Then Application.ActiveSheet.PrintOut End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks