Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have checked other postings regarding VBA codes for making cells mandatory
if another cell is filled. I have tried the different statements in various postings but they did not work for me. I need to have C38 mandatory only if A38 is filled. I also need this condition up to row 46. If cells in column A are filled then the corresponding rows in column C have to be filled, otherwise, the file cannot be saved. Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
in the thisworkbook module:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) set rng = Worksheets("Sheet1").Range("A38:A46") for each cell in rng if not isempty(cell) and isempty(cell.offset(0,2)) then Application.Goto cell.offset(0,2) Cancel = True msgbox "Please fill in cells in column C for " & _ vbNewLine & "corresponding filled in cells in column A in rows " & vbNewLine & "38 to 46. Save is cancelled!" end if Next End Sub -- Regards, Tom Ogilvy "RA" wrote: I have checked other postings regarding VBA codes for making cells mandatory if another cell is filled. I have tried the different statements in various postings but they did not work for me. I need to have C38 mandatory only if A38 is filled. I also need this condition up to row 46. If cells in column A are filled then the corresponding rows in column C have to be filled, otherwise, the file cannot be saved. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Leaving a total sum cell blank until other cells are filled | Excel Worksheet Functions | |||
Fill cells below until next cell is filled | Excel Worksheet Functions | |||
Filled cells dont appear as filled | Excel Discussion (Misc queries) | |||
lock cells until one cell is filled | Excel Programming | |||
Making cells mandatory to fill in if a previous cell contains info | Excel Programming |