Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RA RA is offline
external usenet poster
 
Posts: 53
Default mandatory cells only if another cell is filled

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default mandatory cells only if another cell is filled

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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Leaving a total sum cell blank until other cells are filled Ric Crombie Excel Worksheet Functions 3 December 8th 09 02:29 PM
Fill cells below until next cell is filled JKeef Excel Worksheet Functions 1 December 20th 07 09:55 PM
Filled cells dont appear as filled SMILLS Excel Discussion (Misc queries) 6 October 18th 07 05:28 PM
lock cells until one cell is filled Debbie Excel Programming 2 May 23rd 06 06:39 PM
Making cells mandatory to fill in if a previous cell contains info leonardo Excel Programming 6 February 24th 06 06:43 PM


All times are GMT +1. The time now is 10:03 PM.

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"