ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Return Focus (https://www.excelbanter.com/excel-programming/421612-return-focus.html)

Samuel Looney

Return Focus
 
I am checking cells for null values. I have the before close event. If a cell
is found to be null then it cancels the close event. After the user clicks OK
I would like it to return focus back to the Cells(rownumber, 8). Meaning
return focus by the cell appearing with the bold outline with the cusor
blinking in the cell.

If Cells(rowNumber, 8) = "" And Cells(rowNumber, 9) = "" And
Cells(rowNumber, 10) = "" Then
emptyRow = True
cancel = True
MsgBox "Status for Sheet " & s & " at Row " &
rowNumber & " Must Be Either Owning, Checking, or Loaned"
Exit Do
Sheets(s).Activate
noValue = rowNumber
End If

Gary''s Student

Return Focus
 
After:
Sheets(s).Activate
insert:
Cells(rownumber,9).Select
--
Gary''s Student - gsnu200822


"Samuel Looney" wrote:

I am checking cells for null values. I have the before close event. If a cell
is found to be null then it cancels the close event. After the user clicks OK
I would like it to return focus back to the Cells(rownumber, 8). Meaning
return focus by the cell appearing with the bold outline with the cusor
blinking in the cell.

If Cells(rowNumber, 8) = "" And Cells(rowNumber, 9) = "" And
Cells(rowNumber, 10) = "" Then
emptyRow = True
cancel = True
MsgBox "Status for Sheet " & s & " at Row " &
rowNumber & " Must Be Either Owning, Checking, or Loaned"
Exit Do
Sheets(s).Activate
noValue = rowNumber
End If



All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com