Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default recalling named ranges as must fill cell

on my workbook I have some ranges that must be filled in prior to
saving the file:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim checkCells As Range
Dim cell As Range
Set checkCells = Sheets("Sheet1").Range("A1, B2, C3")
For Each cell In checkCells
Cancel = Cancel Or IsEmpty(cell)
Next cell
If Cancel Then
MsgBox "Cell(s) " & Replace(checkCells.Address( _
False, False), ",", ", ") & _
" must be filled in prior to saving."
End If
End Sub

What I want to acieve is this A1 cosrresponds to Name and B2
corresponds to Address I would like the user to have a flag that sais
you must fill in Name, Address etc and the cells are a different
colour on the spreadsheet.

id it possible?

thanks

Alex
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default recalling named ranges as must fill cell

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim checkCells As Range
Dim cell As Range
Dim msg As String

msg = "Cell(s) "
Set checkCells = Sheets("Sheet1").Range("A1, B2, C3")
For Each cell In checkCells
If IsEmpty(cell.Value) Then
msg = msg & cell.Address(False, False) & vbNewLine
Cancel = True
End If
Next cell
If Cancel Then
MsgBox msg & " must be filled in prior to saving."
End If
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
...
on my workbook I have some ranges that must be filled in prior to
saving the file:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim checkCells As Range
Dim cell As Range
Set checkCells = Sheets("Sheet1").Range("A1, B2, C3")
For Each cell In checkCells
Cancel = Cancel Or IsEmpty(cell)
Next cell
If Cancel Then
MsgBox "Cell(s) " & Replace(checkCells.Address( _
False, False), ",", ", ") & _
" must be filled in prior to saving."
End If
End Sub

What I want to acieve is this A1 cosrresponds to Name and B2
corresponds to Address I would like the user to have a flag that sais
you must fill in Name, Address etc and the cells are a different
colour on the spreadsheet.

id it possible?

thanks

Alex



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
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Excel Programming 3 December 24th 07 01:15 PM
multi-cell named ranges Santa-D Excel Worksheet Functions 1 December 14th 06 02:22 AM
Named Ranges - accessing a cell mojoweiss Excel Discussion (Misc queries) 1 September 1st 05 04:20 PM
Named Cell Ranges Blackcat Excel Discussion (Misc queries) 7 December 9th 04 01:59 PM
Named Cell Ranges Blackcat Excel Discussion (Misc queries) 1 December 9th 04 09:57 AM


All times are GMT +1. The time now is 01:34 AM.

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

About Us

"It's about Microsoft Excel"