Forum Discussion
eesamp
Dec 08, 2020Copper Contributor
How to use vba to unselect a row after use
I have a workbook with multiple sheets. On the master sheet, I "find" a name, the run a vba application to use the data in the row selected by the "find." When that application completes, it returns ...
eesamp
Dec 09, 2020Copper Contributor
That just stops the cutcopymode but leaves the row highlighted.
Also, Application.cutcopymode needs an argument, either True, False or Status
adversi
Dec 09, 2020Iron Contributor
You have to declare it false in the beginning and make it true in the end. See below an example:
Option Explicit
Sub Test()
Application.CutCopyMode = False
Range("E1:E20").copy
Application.Goto Range("A1")
Application.CutCopyMode = True
End Sub
- eesampDec 10, 2020Copper Contributor
Ok, I have solved the problem. here is the code now at the end of the PrSheet routine...
' ...and Print the label
' TURNED OFF DURING DEBUGGING TO SAVE LABELS
' ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
' Return to master sheet
Worksheets("HPRAmasterDB2").Activate 'and un select the highlighted row but stay there
Application.CutCopyMode = True
Range("F2").Select
ActiveWindow.FreezePanes = True
' MsgBox rownumber
ActiveSheet.Range("$A$" & rownumber).Select
End Sub