Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default OrderThenFindEmptyCell

I have this macro which I pasted below and it works great. However once I
lock cells J7:116 and L7:116, the macro no longer works. Do you know what I
can do differently so that I can run the macro below but still keep cells
J7:116 and L7:116 locked?

Sub OrderThenFindEmptyCell()
Dim BlankCell As Range
With Range("B7:B11")
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Order"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Set BlankCell = .Find("", After:=Range("B11"), SearchOrder:=xlByRows)
BlankCell.Select
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default OrderThenFindEmptyCell

Unprotect the sheet at the start of the macro and protect it again at the end.

ActiveSheet.Unprotect ("MyPassword")

ActiveSheet.Protect ("MyPassword")

If you want any special parameters when protecting then record a macro to
get the syntax however, it does not record the password; you need to edit the
code to insert password.

--
Regards,

OssieMac


"Workbook" wrote:

I have this macro which I pasted below and it works great. However once I
lock cells J7:116 and L7:116, the macro no longer works. Do you know what I
can do differently so that I can run the macro below but still keep cells
J7:116 and L7:116 locked?

Sub OrderThenFindEmptyCell()
Dim BlankCell As Range
With Range("B7:B11")
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Order"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Set BlankCell = .Find("", After:=Range("B11"), SearchOrder:=xlByRows)
BlankCell.Select
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default OrderThenFindEmptyCell

O I totally overlooked that one. I was concentrating on format, protection,
unlock cells part. Thanks for the tip you were right! I pasted the
completed working macro below.

Thank you again.

Sub OrderThenFindEmptyCell()
ActiveSheet.Unprotect

Dim BlankCell As Range
With Range("B7:B11")
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Order"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Set BlankCell = .Find("", After:=Range("B11"), SearchOrder:=xlByRows)
BlankCell.Select
End With
ActiveSheet.Protect
End Sub


"OssieMac" wrote:

Unprotect the sheet at the start of the macro and protect it again at the end.

ActiveSheet.Unprotect ("MyPassword")

ActiveSheet.Protect ("MyPassword")

If you want any special parameters when protecting then record a macro to
get the syntax however, it does not record the password; you need to edit the
code to insert password.

--
Regards,

OssieMac


"Workbook" wrote:

I have this macro which I pasted below and it works great. However once I
lock cells J7:116 and L7:116, the macro no longer works. Do you know what I
can do differently so that I can run the macro below but still keep cells
J7:116 and L7:116 locked?

Sub OrderThenFindEmptyCell()
Dim BlankCell As Range
With Range("B7:B11")
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Order"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Set BlankCell = .Find("", After:=Range("B11"), SearchOrder:=xlByRows)
BlankCell.Select
End With
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default OrderThenFindEmptyCell

Hey thanks guys! This works great!

"MCheru" wrote:

O I totally overlooked that one. I was concentrating on format, protection,
unlock cells part. Thanks for the tip you were right! I pasted the
completed working macro below.

Thank you again.

Sub OrderThenFindEmptyCell()
ActiveSheet.Unprotect

Dim BlankCell As Range
With Range("B7:B11")
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Order"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Set BlankCell = .Find("", After:=Range("B11"), SearchOrder:=xlByRows)
BlankCell.Select
End With
ActiveSheet.Protect
End Sub


"OssieMac" wrote:

Unprotect the sheet at the start of the macro and protect it again at the end.

ActiveSheet.Unprotect ("MyPassword")

ActiveSheet.Protect ("MyPassword")

If you want any special parameters when protecting then record a macro to
get the syntax however, it does not record the password; you need to edit the
code to insert password.

--
Regards,

OssieMac


"Workbook" wrote:

I have this macro which I pasted below and it works great. However once I
lock cells J7:116 and L7:116, the macro no longer works. Do you know what I
can do differently so that I can run the macro below but still keep cells
J7:116 and L7:116 locked?

Sub OrderThenFindEmptyCell()
Dim BlankCell As Range
With Range("B7:B11")
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Order"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Set BlankCell = .Find("", After:=Range("B11"), SearchOrder:=xlByRows)
BlankCell.Select
End With
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"