determine if activecell in specific worksheet and column

  • Thread starter Thread starter Scotty9349
  • Start date Start date
S

Scotty9349

I have a workbook that contains 3+ worksheets. Within 2 of those worksheets I
have 2 columns each that are for dates. WHen I run my insert_date sub (which
I have working) I only want a date to be inserted in those specific columns.
The cell that they enter that date is the activecell.

I hope this makes sense.
 
Scotty,

Post your code, and a description of where you want the date placed.

HTH,
Bernie
MS Excel MVP
 
Your description is just a little bit too skimpy for us (well, at least me)
to figure out what you have and what you want to do with it. For example,
you say "they enter the date in the activecell", but earlier you say the
name of your sub is "insert_date"... are you taking the date the user enters
and putting it somewhere else (those 2 columns you mentioned maybe), or is
something else going on? Can you provide us with more details?
 
I have a workbook that contains 3+ worksheets. Within 2 of those worksheets I
have 2 columns each that are for dates. WHen I run my insert_date sub (which
I have working) I only want a date to be inserted in those specific columns.
The cell that they enter that date is the activecell.

I hope this makes sense.

If ActiveCell.Parent.Name <> "Name of sheet that doesn't get dates" Then
If ActiveCell.Column = 3 Then 'Column C
'do thing
End If
End If

You can also use ActiveCell.Parent.Codename if you're worried about someone
renaming the sheets.
 
Sorry for the confusion I caused. Let's see if I can explain better.

I have a workbook with 3 worksheets; Estimates, Projects, Closed. Within the
Projects and Closed worksheets columns A and B are for user entered dates.

I wrote a small userform to enter the info automatically. However, in the
event the user wanted to change the date later on I am working on a stand
alone insert_date sub.

Using the frmCalendar provided by MS Excel, I would like to pass the entered
date to a cell the user selects. The only stipulation is that the user must
select a cell in column A or B of the Projects or Closed worksheets. I can
pass the date into any cell the user selects, I just want to limit them where
dates can be entered.

I tried the following:

If ActiveSheet.Name = "Projects" Or ActiveSheet.Name = "Closed" Then
If ActiveCell.Column = "A" Or ActiveCell.Column = "B" Then
Insert_date
End If
Else
MsgBox "Enter date in correct field"
End If
 
If ActiveSheet.Name = "Projects" Or ActiveSheet.Name = "Closed" Then
If ActiveCell.Column = 1 Or ActiveCell.Column = 2 Then
Insert_date
End If
Else
MsgBox "Enter date in correct field"
End If

HTH,
Bernie
MS Excel MVP
 
Thanks. Boy do I feel stupid for being so close.

Bernie Deitrick said:
If ActiveSheet.Name = "Projects" Or ActiveSheet.Name = "Closed" Then
If ActiveCell.Column = 1 Or ActiveCell.Column = 2 Then
Insert_date
End If
Else
MsgBox "Enter date in correct field"
End If

HTH,
Bernie
MS Excel MVP
 
Back
Top