I have a workbook with two worksheets. I need a macro to print worksheet1 if worksheet2 has the value "X" (either caps or lowercase) in range A1:A3000. Can anyone help with this?
Thanks
I have a workbook with two worksheets. I need a macro to print worksheet1 if worksheet2 has the value "X" (either caps or lowercase) in range A1:A3000. Can anyone help with this?
Thanks
A good place to start
http://www.excelforum.com/excel-prog...int-areas.html
then try some thing like
![]()
Please Login or Register to view this content.
Thanks for your reply, but I am still not sure how to do this. This is what I have and it only prints if I enter an x in cell a5, which is offset 4 from A1. I want it to print if x is in any cell from a4:a3000. A1 has the name of the sheet I want to print. I have another macro at the "on change" that will run 3 macros one right after so I don't need this macro on change. Thanks for your help.
Sub PrintCM()
'
' PrintCM Macro
'
Dim bFirst As Boolean, sh As Object
Dim cell As Range
Set sh = ActiveSheet
bFirst = True
For Each cell In Worksheets("CopyFrom").Range("a1:a1")
If LCase(cell.Offset(4, 0).Value) = "x" Then
Worksheets(cell.Value).Select Replace:=bFirst
bFirst = False
End If
Next
If Not bFirst Then
ActiveWindow.SelectedSheets.PrintOut
sh.Select
End If
End Sub
Hello mugs62,
To make your posts easier to read, copy, and edit please wrap your code. I did it for you this time. Here is how you can do it next time.
How to wrap your Code using the # icon
1. Select all your code using the mouse.
2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.
To manually insert the tags
Use the Bulletin Board Code Tags
[code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end of the last line.
To learn more about BB codes used in this forum, just click on the link below...
Bulletin Board Codes Tags
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks