If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
insert date
Oh. . . o.K. I can do that, now I want to have the same code in each
worksheet of the workbook,correct? i.e. I already have the date code you provided in there and have tried eliminating the end sub between them, seems it does not want to work this way. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub I have been looking to learn more about this and have found some info about this and found some info in "CONTEXTURES" web sight dealing with dynamic lists that will update whenever something is added. Ilike that feature and am also trying to figure this one out. I'll get eventually! "CLR" wrote: Hi Larry........ That's a Change-event macro that goes in a Worksheet module, not a Regular module like module2. Right click on the sheet tab, then choose ViewCode, then paste it in the window that appears.......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi chuck, I put the following in a new worksheet module( module 2): Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub I am getting an error at:Operatorxl Between for := . I hae tried to change the syntax on this but it will not stop showing an error. Any ideas? thanks "CLR" wrote: Happy to help Larry, and thank you kindly for the feedback..........I enjoyed your story too...........the best to you and yours as well..... Vaya con Dios, Chuck, CABGx3 "Larry" wrote: chuck, Thanks, my wife and I agree, we have the same philosophy and enjoy it much. Sometimes we will be out at a restaurant and see someone or a couple and get the waiter to just give us the bill, telling them only it is taken care of, it's great to see their smiles and amusement. 'course one time I did this when I spied a young man and his son, turns out they were having a birthday party upstairs with 15 people! what a joyous surprise; we were blessed with a good income then and thought little of it except to chuckle and swear to be more aware next time. May you and yours have a great Independence day weekend "CLR" wrote: Oh, I don't drink or smoke since my Triple, but thanks anyway. One night long ago I was on my way home from work at 10pm on the freeway as I lived all the way across town, when my car quit running. I was poor, the gas read "E" so I figured I had run out and hitch-hiked a couple of miles to a get-off at a service station. The guy who picked me up waited for me and turned around and drove me back to my car and waited for me to get it started. It wouldn't start, so he said "I've been a Ford mechanic for 20 years, let me look at it". He did and immediately found the Distributor cap to be broken in two pieces. He said wait and went back to his car and returned with a brand new one, put it on and the car started fine. I offered a Steak dinner, my 1st born, anything in return for his kindness. He said only, "help someone else whenever you get a chance"........If you really want to thank me, then you do the same, "help someone else whenever you get a chance". Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Say Chuck, I know I'm gonna owe you a six pack or something by the time I’m done, do you happen to have a quick little bit of code that will open a drop down each time an empty cell is clicked? Something that allows the user to select from a list of pre-written entries? Just askin' Thanks again; oh and what kind of beer or wine drink? "CLR" wrote: Glad you got it working...........and thanks for the feedback. Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Thanks chuck, You're great, I have it now. Your loyal servant : ) , larry "CLR" wrote: You're doing fine, it's just that this particular macro goes in the Worksheet module, not the Workbook and not a regular module..........rightclick on the sheet tab, then Viewcode, then in the small window on the left at the top of the editor window, choose Worksheet, then paste the code in the large editor window..........and if you copy/paste the macro out of your email, don't forget to add the End Sub at the end.....post back if you still have problems. hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Goodmorning Chuck, I have been trying to get the code you posted to work in my workbook but so far have not. I did change the "1" to a "3", that's all. I pasted this code into the "This workbook" with some other code I have: Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If Sub Workbook_Open() Columns("E:IV").Select Selection.EntireColumn.Hidden = True MsgBox "If you are entering a new waiver item, go ahead and enter it in the next open line. When you are ready for a waiver number click in the empty box and it will take you to the new waiver number generator; Follow the instructions in the box there. To get a current date just select the empty date box and hold down the Ctrl and ; keys, a new date will appear! When you are done just click the RED X at the upper right to close, it will automatically save your entries and the next time you need a number for any waiver card the same steps will be taken: YOU NEED TO CLICK OK TO START ENTERING DATA" ThisWorkbook.Save End Sub noJoy I then placed it into an existing module 1above this code: Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End Sub\ again, no joy I next created a new module and pasted there and still no luck. I am just too much of a novice to do this in a timely manner; Any more help? Thanks man. larry ************************************ "CLR" wrote: Actually, to change from column A to column C, you would change the line from: If ActiveCell.Column = 1 To: If ActiveCell.Column = 3 The two "columnA" in the notations can be changed also, but are only comments and do not affect the operation Vaya con Dios Chuck, CABGx3 "Larry" wrote: Thanks again, I'll try thei right away. I take it I should replace A with C to change target column? Take care, larry "CLR" wrote: This Change-event macro should do the job automatically......if the user selects a cell in column that has a value therein, no affect.....if the cell is blank, the macro will insert todays date. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column A when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 1 Then 'Limits macro action to column A If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub "Larry" wrote: Thanks CLR, ans: yes and old dates remain. Some of the folks usimng it can't seem to remember the ctrl ; keys. Thanks for the help "CLR" wrote: A couple of questions..... 1-Are you wanting today's date inserted in an empty cell whenever it's selected in a certain column? 2-What would you like to have happen to cells in that column being selected that already contain a date, or some other value? You can do nearly as good by just holding down the Ctrl key and pressing the semicolon key.........this will insert today's date in the selected cell. hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi folks, I'd like to inset a date automatically when ever a cell within a single column is selected. Can I do this? |
#22
|
|||
|
|||
insert date
I'm on my way out right now, will have to pick any follow on up from homw
later......for now, try not only eliminating the ENDSUB between the two, but also the sencond leading line of Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If that don't work, I'll have to look at it later......... Quitting time in St. Petersburg, Florida........ Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Oh. . . o.K. I can do that, now I want to have the same code in each worksheet of the workbook,correct? i.e. I already have the date code you provided in there and have tried eliminating the end sub between them, seems it does not want to work this way. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub I have been looking to learn more about this and have found some info about this and found some info in "CONTEXTURES" web sight dealing with dynamic lists that will update whenever something is added. Ilike that feature and am also trying to figure this one out. I'll get eventually! "CLR" wrote: Hi Larry........ That's a Change-event macro that goes in a Worksheet module, not a Regular module like module2. Right click on the sheet tab, then choose ViewCode, then paste it in the window that appears.......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi chuck, I put the following in a new worksheet module( module 2): Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub I am getting an error at:Operatorxl Between for := . I hae tried to change the syntax on this but it will not stop showing an error. Any ideas? thanks "CLR" wrote: Happy to help Larry, and thank you kindly for the feedback..........I enjoyed your story too...........the best to you and yours as well..... Vaya con Dios, Chuck, CABGx3 "Larry" wrote: chuck, Thanks, my wife and I agree, we have the same philosophy and enjoy it much. Sometimes we will be out at a restaurant and see someone or a couple and get the waiter to just give us the bill, telling them only it is taken care of, it's great to see their smiles and amusement. 'course one time I did this when I spied a young man and his son, turns out they were having a birthday party upstairs with 15 people! what a joyous surprise; we were blessed with a good income then and thought little of it except to chuckle and swear to be more aware next time. May you and yours have a great Independence day weekend "CLR" wrote: Oh, I don't drink or smoke since my Triple, but thanks anyway. One night long ago I was on my way home from work at 10pm on the freeway as I lived all the way across town, when my car quit running. I was poor, the gas read "E" so I figured I had run out and hitch-hiked a couple of miles to a get-off at a service station. The guy who picked me up waited for me and turned around and drove me back to my car and waited for me to get it started. It wouldn't start, so he said "I've been a Ford mechanic for 20 years, let me look at it". He did and immediately found the Distributor cap to be broken in two pieces. He said wait and went back to his car and returned with a brand new one, put it on and the car started fine. I offered a Steak dinner, my 1st born, anything in return for his kindness. He said only, "help someone else whenever you get a chance"........If you really want to thank me, then you do the same, "help someone else whenever you get a chance". Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Say Chuck, I know I'm gonna owe you a six pack or something by the time I’m done, do you happen to have a quick little bit of code that will open a drop down each time an empty cell is clicked? Something that allows the user to select from a list of pre-written entries? Just askin' Thanks again; oh and what kind of beer or wine drink? "CLR" wrote: Glad you got it working...........and thanks for the feedback. Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Thanks chuck, You're great, I have it now. Your loyal servant : ) , larry "CLR" wrote: You're doing fine, it's just that this particular macro goes in the Worksheet module, not the Workbook and not a regular module..........rightclick on the sheet tab, then Viewcode, then in the small window on the left at the top of the editor window, choose Worksheet, then paste the code in the large editor window..........and if you copy/paste the macro out of your email, don't forget to add the End Sub at the end.....post back if you still have problems. hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Goodmorning Chuck, I have been trying to get the code you posted to work in my workbook but so far have not. I did change the "1" to a "3", that's all. I pasted this code into the "This workbook" with some other code I have: Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If Sub Workbook_Open() Columns("E:IV").Select Selection.EntireColumn.Hidden = True MsgBox "If you are entering a new waiver item, go ahead and enter it in the next open line. When you are ready for a waiver number click in the empty box and it will take you to the new waiver number generator; Follow the instructions in the box there. To get a current date just select the empty date box and hold down the Ctrl and ; keys, a new date will appear! When you are done just click the RED X at the upper right to close, it will automatically save your entries and the next time you need a number for any waiver card the same steps will be taken: YOU NEED TO CLICK OK TO START ENTERING DATA" ThisWorkbook.Save End Sub noJoy I then placed it into an existing module 1above this code: Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End Sub\ again, no joy I next created a new module and pasted there and still no luck. I am just too much of a novice to do this in a timely manner; Any more help? Thanks man. larry ************************************ "CLR" wrote: Actually, to change from column A to column C, you would change the line from: If ActiveCell.Column = 1 To: If ActiveCell.Column = 3 The two "columnA" in the notations can be changed also, but are only comments and do not affect the operation Vaya con Dios Chuck, CABGx3 "Larry" wrote: Thanks again, I'll try thei right away. I take it I should replace A with C to change target column? Take care, larry "CLR" wrote: This Change-event macro should do the job automatically......if the user selects a cell in column that has a value therein, no affect.....if the cell is blank, the macro will insert todays date. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column A when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 1 Then 'Limits macro action to column A If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub "Larry" wrote: Thanks CLR, ans: yes and old dates remain. Some of the folks usimng it can't seem to remember the ctrl ; keys. Thanks |
#23
|
|||
|
|||
insert date
Ok Larry...........I checked it out a little more here at home..........the
only difference is that unless you want to have a different List on each sheet, then you have to give the List a RangeName on one sheet.........I used "MyList" so the code works with that but yu can change it if you want, or use separate lists on each sheet, according to your needs...........here's the code for both of the macros to work together.........must be put in worksheet module of each sheet you want them to work in......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=mylist" '$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote in message ... Oh. . . o.K. I can do that, now I want to have the same code in each worksheet of the workbook,correct? i.e. I already have the date code you provided in there and have tried eliminating the end sub between them, seems it does not want to work this way. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub I have been looking to learn more about this and have found some info about this and found some info in "CONTEXTURES" web sight dealing with dynamic lists that will update whenever something is added. Ilike that feature and am also trying to figure this one out. I'll get eventually! "CLR" wrote: Hi Larry........ That's a Change-event macro that goes in a Worksheet module, not a Regular module like module2. Right click on the sheet tab, then choose ViewCode, then paste it in the window that appears.......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi chuck, I put the following in a new worksheet module( module 2): Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub I am getting an error at:Operatorxl Between for := . I hae tried to change the syntax on this but it will not stop showing an error. Any ideas? thanks "CLR" wrote: Happy to help Larry, and thank you kindly for the feedback..........I enjoyed your story too...........the best to you and yours as well..... Vaya con Dios, Chuck, CABGx3 "Larry" wrote: chuck, Thanks, my wife and I agree, we have the same philosophy and enjoy it much. Sometimes we will be out at a restaurant and see someone or a couple and get the waiter to just give us the bill, telling them only it is taken care of, it's great to see their smiles and amusement. 'course one time I did this when I spied a young man and his son, turns out they were having a birthday party upstairs with 15 people! what a joyous surprise; we were blessed with a good income then and thought little of it except to chuckle and swear to be more aware next time. May you and yours have a great Independence day weekend "CLR" wrote: Oh, I don't drink or smoke since my Triple, but thanks anyway. One night long ago I was on my way home from work at 10pm on the freeway as I lived all the way across town, when my car quit running. I was poor, the gas read "E" so I figured I had run out and hitch-hiked a couple of miles to a get-off at a service station. The guy who picked me up waited for me and turned around and drove me back to my car and waited for me to get it started. It wouldn't start, so he said "I've been a Ford mechanic for 20 years, let me look at it". He did and immediately found the Distributor cap to be broken in two pieces. He said wait and went back to his car and returned with a brand new one, put it on and the car started fine. I offered a Steak dinner, my 1st born, anything in return for his kindness. He said only, "help someone else whenever you get a chance"........If you really want to thank me, then you do the same, "help someone else whenever you get a chance". Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Say Chuck, I know I'm gonna owe you a six pack or something by the time I'm done, do you happen to have a quick little bit of code that will open a drop down each time an empty cell is clicked? Something that allows the user to select from a list of pre-written entries? Just askin' Thanks again; oh and what kind of beer or wine drink? "CLR" wrote: Glad you got it working...........and thanks for the feedback. Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Thanks chuck, You're great, I have it now. Your loyal servant : ) , larry "CLR" wrote: You're doing fine, it's just that this particular macro goes in the Worksheet module, not the Workbook and not a regular module..........rightclick on the sheet tab, then Viewcode, then in the small window on the left at the top of the editor window, choose Worksheet, then paste the code in the large editor window..........and if you copy/paste the macro out of your email, don't forget to add the End Sub at the end.....post back if you still have problems. hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Goodmorning Chuck, I have been trying to get the code you posted to work in my workbook but so far have not. I did change the "1" to a "3", that's all. I pasted this code into the "This workbook" with some other code I have: Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If Sub Workbook_Open() Columns("E:IV").Select Selection.EntireColumn.Hidden = True MsgBox "If you are entering a new waiver item, go ahead and enter it in the next open line. When you are ready for a waiver number click in the empty box and it will take you to the new waiver number generator; Follow the instructions in the box there. To get a current date just select the empty date box and hold down the Ctrl and ; keys, a new date will appear! When you are done just click the RED X at the upper right to close, it will automatically save your entries and the next time you need a number for any waiver card the same steps will be taken: YOU NEED TO CLICK OK TO START ENTERING DATA" ThisWorkbook.Save End Sub noJoy I then placed it into an existing module 1above this code: Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End Sub\ again, no joy I next created a new module and pasted there and still no luck. I am just too much of a novice to do this in a timely manner; Any more help? Thanks man. larry ************************************ "CLR" wrote: Actually, to change from column A to column C, you would change the line from: If ActiveCell.Column = 1 To: If ActiveCell.Column = 3 The two "columnA" in the notations can be changed also, but are only comments and do not affect the operation Vaya con Dios Chuck, CABGx3 "Larry" wrote: Thanks again, I'll try thei right away. I take it I should replace A with C to change target column? Take care, larry "CLR" wrote: This Change-event macro should do the job automatically......if the user selects a cell in column that has a value therein, no affect.....if the cell is blank, the macro will insert todays date. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column A when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 1 Then 'Limits macro action to column A If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub "Larry" wrote: Thanks CLR, ans: yes and old dates remain. Some of the folks usimng it can't seem to remember the ctrl ; keys. Thanks for the help "CLR" wrote: A couple of questions..... 1-Are you wanting today's date inserted in an empty cell whenever it's selected in a certain column? 2-What would you like to have happen to cells in that column being selected that already contain a date, or some other value? You can do nearly as good by just holding down the Ctrl key and pressing the semicolon key.........this will insert today's date in the selected cell. hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi folks, I'd like to inset a date automatically when ever a cell within a single column is selected. Can I do this? |
#24
|
|||
|
|||
insert date
Chuck, yer a prince. I hope your wekend went well. Best to you and your, larry
"CLR" wrote: Ok Larry...........I checked it out a little more here at home..........the only difference is that unless you want to have a different List on each sheet, then you have to give the List a RangeName on one sheet.........I used "MyList" so the code works with that but yu can change it if you want, or use separate lists on each sheet, according to your needs...........here's the code for both of the macros to work together.........must be put in worksheet module of each sheet you want them to work in......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=mylist" '$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote in message ... Oh. . . o.K. I can do that, now I want to have the same code in each worksheet of the workbook,correct? i.e. I already have the date code you provided in there and have tried eliminating the end sub between them, seems it does not want to work this way. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub I have been looking to learn more about this and have found some info about this and found some info in "CONTEXTURES" web sight dealing with dynamic lists that will update whenever something is added. Ilike that feature and am also trying to figure this one out. I'll get eventually! "CLR" wrote: Hi Larry........ That's a Change-event macro that goes in a Worksheet module, not a Regular module like module2. Right click on the sheet tab, then choose ViewCode, then paste it in the window that appears.......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi chuck, I put the following in a new worksheet module( module 2): Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub I am getting an error at:Operatorxl Between for := . I hae tried to change the syntax on this but it will not stop showing an error. Any ideas? thanks "CLR" wrote: Happy to help Larry, and thank you kindly for the feedback..........I enjoyed your story too...........the best to you and yours as well..... Vaya con Dios, Chuck, CABGx3 "Larry" wrote: chuck, Thanks, my wife and I agree, we have the same philosophy and enjoy it much. Sometimes we will be out at a restaurant and see someone or a couple and get the waiter to just give us the bill, telling them only it is taken care of, it's great to see their smiles and amusement. 'course one time I did this when I spied a young man and his son, turns out they were having a birthday party upstairs with 15 people! what a joyous surprise; we were blessed with a good income then and thought little of it except to chuckle and swear to be more aware next time. May you and yours have a great Independence day weekend "CLR" wrote: Oh, I don't drink or smoke since my Triple, but thanks anyway. One night long ago I was on my way home from work at 10pm on the freeway as I lived all the way across town, when my car quit running. I was poor, the gas read "E" so I figured I had run out and hitch-hiked a couple of miles to a get-off at a service station. The guy who picked me up waited for me and turned around and drove me back to my car and waited for me to get it started. It wouldn't start, so he said "I've been a Ford mechanic for 20 years, let me look at it". He did and immediately found the Distributor cap to be broken in two pieces. He said wait and went back to his car and returned with a brand new one, put it on and the car started fine. I offered a Steak dinner, my 1st born, anything in return for his kindness. He said only, "help someone else whenever you get a chance"........If you really want to thank me, then you do the same, "help someone else whenever you get a chance". Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Say Chuck, I know I'm gonna owe you a six pack or something by the time I'm done, do you happen to have a quick little bit of code that will open a drop down each time an empty cell is clicked? Something that allows the user to select from a list of pre-written entries? Just askin' Thanks again; oh and what kind of beer or wine drink? "CLR" wrote: Glad you got it working...........and thanks for the feedback. Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Thanks chuck, You're great, I have it now. Your loyal servant : ) , larry "CLR" wrote: You're doing fine, it's just that this particular macro goes in the Worksheet module, not the Workbook and not a regular module..........rightclick on the sheet tab, then Viewcode, then in the small window on the left at the top of the editor window, choose Worksheet, then paste the code in the large editor window..........and if you copy/paste the macro out of your email, don't forget to add the End Sub at the end.....post back if you still have problems. hth Vaya con Dios, Chuck, CABGx3 |
#25
|
|||
|
|||
insert date
Glad to hear you got it working Larry. Yup, my weekend is going
good............I got the whole week off (without pay). I'm 67 and just moved 11,200 pounds of marble chips by hand, filling in our flower beds........really looks nifty, but I can hardly move now g Vaya con Dios, Chuck, CABGx3 "Larry" wrote in message ... Chuck, yer a prince. I hope your wekend went well. Best to you and your, larry "CLR" wrote: Ok Larry...........I checked it out a little more here at home..........the only difference is that unless you want to have a different List on each sheet, then you have to give the List a RangeName on one sheet.........I used "MyList" so the code works with that but yu can change it if you want, or use separate lists on each sheet, according to your needs...........here's the code for both of the macros to work together.........must be put in worksheet module of each sheet you want them to work in......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=mylist" '$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote in message ... Oh. . . o.K. I can do that, now I want to have the same code in each worksheet of the workbook,correct? i.e. I already have the date code you provided in there and have tried eliminating the end sub between them, seems it does not want to work this way. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Automatically inserts today's date in cell in column C when selected 'if the cell was empty. Does not overwrite occupied cell. If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell End If Else End If End Sub I have been looking to learn more about this and have found some info about this and found some info in "CONTEXTURES" web sight dealing with dynamic lists that will update whenever something is added. Ilike that feature and am also trying to figure this one out. I'll get eventually! "CLR" wrote: Hi Larry........ That's a Change-event macro that goes in a Worksheet module, not a Regular module like module2. Right click on the sheet tab, then choose ViewCode, then paste it in the window that appears.......... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in 'column D ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=$J$1:$J$5" 'J1:J5 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi chuck, I put the following in a new worksheet module( module 2): Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 'Macro will add Validation to a Dropdown list to any blank selected cell in Column E ActiveCell.Select If ActiveCell.Column = 4 Then 'Limits macro action to column D If ActiveCell.Value = "" Then 'Check to see if Target cell empty ActiveCell.Select With Selection.Validation .Delete .Add Type:=xl ValidateList, AlertStyle:=xlValidAlertStop, Operator:= xl Between , Formula1:="=$E$1:$E$50" 'E1:E50 is location of the list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Else End If Else End If End Sub I am getting an error at:Operatorxl Between for := . I hae tried to change the syntax on this but it will not stop showing an error. Any ideas? thanks "CLR" wrote: Happy to help Larry, and thank you kindly for the feedback..........I enjoyed your story too...........the best to you and yours as well..... Vaya con Dios, Chuck, CABGx3 "Larry" wrote: chuck, Thanks, my wife and I agree, we have the same philosophy and enjoy it much. Sometimes we will be out at a restaurant and see someone or a couple and get the waiter to just give us the bill, telling them only it is taken care of, it's great to see their smiles and amusement. 'course one time I did this when I spied a young man and his son, turns out they were having a birthday party upstairs with 15 people! what a joyous surprise; we were blessed with a good income then and thought little of it except to chuckle and swear to be more aware next time. May you and yours have a great Independence day weekend "CLR" wrote: Oh, I don't drink or smoke since my Triple, but thanks anyway. One night long ago I was on my way home from work at 10pm on the freeway as I lived all the way across town, when my car quit running. I was poor, the gas read "E" so I figured I had run out and hitch-hiked a couple of miles to a get-off at a service station. The guy who picked me up waited for me and turned around and drove me back to my car and waited for me to get it started. It wouldn't start, so he said "I've been a Ford mechanic for 20 years, let me look at it". He did and immediately found the Distributor cap to be broken in two pieces. He said wait and went back to his car and returned with a brand new one, put it on and the car started fine. I offered a Steak dinner, my 1st born, anything in return for his kindness. He said only, "help someone else whenever you get a chance"........If you really want to thank me, then you do the same, "help someone else whenever you get a chance". Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Say Chuck, I know I'm gonna owe you a six pack or something by the time I'm done, do you happen to have a quick little bit of code that will open a drop down each time an empty cell is clicked? Something that allows the user to select from a list of pre-written entries? Just askin' Thanks again; oh and what kind of beer or wine drink? "CLR" wrote: Glad you got it working...........and thanks for the feedback. Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Thanks chuck, You're great, I have it now. Your loyal servant : ) , larry "CLR" wrote: You're doing fine, it's just that this particular macro goes in the Worksheet module, not the Workbook and not a regular module..........rightclick on the sheet tab, then Viewcode, then in the small window on the left at the top of the editor window, choose Worksheet, then paste the code in the large editor window..........and if you copy/paste the macro out of your email, don't forget to add the End Sub at the end.....post back if you still have problems. hth Vaya con Dios, Chuck, CABGx3 |
#26
|
|||
|
|||
New Code
Hi Chuck,
I found this handy bit of code IN Contextures samples. I managed to tweat it to do what I have been after. IN MODULE 1 I HAVE: Option Explicit Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End If Else End If End Sub NO SHEET 1OR2 IN SHEET 3 (LISTS)I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Columns(1).Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom End Sub IN SHEET 4(86x36236; an auto number) I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next Dim ws As Worksheet Dim i As Integer Set ws = Worksheets("Lists") If Target.Column = 3 And Target.Row 1 Then If Application.WorksheetFunction.CountIf(ws.Range("Na meList"), Target.Value) Then Exit Sub Else i = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1 ws.Range("A" & i).Value = Target.Value ws.Range("NameList").Sort Key1:=ws.Range("A1"), _ Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom End If End If End Sub THIS WORKS GREAT IN AUTO UPDATING MY LIST BUT I CANNOT GET THE DATE ENTRY CODE TO PLAY WITH THE OTHER CODE. I AM ASSUMING I NEED TO HAVE IT IN SHEET MODULE 4 WHERE ALL THE WORK IS BEING DONE? I WANT TO ADD THE FOLLOWING CODE YOU PROVIDED; HELP?? If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub |
#27
|
|||
|
|||
New Code
Hi Larry..........
Just add my code as a complete separate macro below the other one you have for Sheet4..........just copy what is below here and paste it in place below the other macro after it's "END SUB"...... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi Chuck, I found this handy bit of code IN Contextures samples. I managed to tweat it to do what I have been after. IN MODULE 1 I HAVE: Option Explicit Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End If Else End If End Sub NO SHEET 1OR2 IN SHEET 3 (LISTS)I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Columns(1).Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom End Sub IN SHEET 4(86x36236; an auto number) I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next Dim ws As Worksheet Dim i As Integer Set ws = Worksheets("Lists") If Target.Column = 3 And Target.Row 1 Then If Application.WorksheetFunction.CountIf(ws.Range("Na meList"), Target.Value) Then Exit Sub Else i = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1 ws.Range("A" & i).Value = Target.Value ws.Range("NameList").Sort Key1:=ws.Range("A1"), _ Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom End If End If End Sub THIS WORKS GREAT IN AUTO UPDATING MY LIST BUT I CANNOT GET THE DATE ENTRY CODE TO PLAY WITH THE OTHER CODE. I AM ASSUMING I NEED TO HAVE IT IN SHEET MODULE 4 WHERE ALL THE WORK IS BEING DONE? I WANT TO ADD THE FOLLOWING CODE YOU PROVIDED; HELP?? If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub |
#28
|
|||
|
|||
My newest setup
thanks Chuck,
I thought I had tried that but it is working pretty good now. I am getting close to what I am after. There are two issues I am searching to solve: 1: The first list(column A) on the Lists worksheet can contain any number of items but the input worksheet (column C) where descrepencies are annotated, will only go to row 17 and then no drop down will appear. I tried to create a combo box and set the rows but this did not change the limitation I am having. 2: The second list (column C) on the listss page is static and has a rangename "Initials" ,it is finite and has a width of 8.43. On the input sheet this drop down is o.k. except for the format, the column width is pretty wide and I have not found the way to control this demension. As Always, I appreciate your help and knowledge greatly. Larry "CLR" wrote: Hi Larry.......... Just add my code as a complete separate macro below the other one you have for Sheet4..........just copy what is below here and paste it in place below the other macro after it's "END SUB"...... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi Chuck, I found this handy bit of code IN Contextures samples. I managed to tweat it to do what I have been after. IN MODULE 1 I HAVE: Option Explicit Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End If Else End If End Sub NO SHEET 1OR2 IN SHEET 3 (LISTS)I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Columns(1).Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom End Sub IN SHEET 4(86x36236; an auto number) I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next Dim ws As Worksheet Dim i As Integer Set ws = Worksheets("Lists") If Target.Column = 3 And Target.Row 1 Then If Application.WorksheetFunction.CountIf(ws.Range("Na meList"), Target.Value) Then Exit Sub Else i = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1 ws.Range("A" & i).Value = Target.Value ws.Range("NameList").Sort Key1:=ws.Range("A1"), _ Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom End If End If End Sub THIS WORKS GREAT IN AUTO UPDATING MY LIST BUT I CANNOT GET THE DATE ENTRY CODE TO PLAY WITH THE OTHER CODE. I AM ASSUMING I NEED TO HAVE IT IN SHEET MODULE 4 WHERE ALL THE WORK IS BEING DONE? I WANT TO ADD THE FOLLOWING CODE YOU PROVIDED; HELP?? If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub |
#29
|
|||
|
|||
My newest setup
Hi Larry.........
Well, this has gone beyond the point where I can understand it in my old head without actualy seeing code or seeing it work...........if you want, you can send a copy to my home addy with an explanation of what you are supposed to see and where..........or whatever, and I will take a look......... My home addy is croberts at tampabay period rr period com, making the obvious replacements. Vaya con Dios, Chuck, CABGx3 "Larry" wrote in message ... thanks Chuck, I thought I had tried that but it is working pretty good now. I am getting close to what I am after. There are two issues I am searching to solve: 1: The first list(column A) on the Lists worksheet can contain any number of items but the input worksheet (column C) where descrepencies are annotated, will only go to row 17 and then no drop down will appear. I tried to create a combo box and set the rows but this did not change the limitation I am having. 2: The second list (column C) on the listss page is static and has a rangename "Initials" ,it is finite and has a width of 8.43. On the input sheet this drop down is o.k. except for the format, the column width is pretty wide and I have not found the way to control this demension. As Always, I appreciate your help and knowledge greatly. Larry "CLR" wrote: Hi Larry.......... Just add my code as a complete separate macro below the other one you have for Sheet4..........just copy what is below here and paste it in place below the other macro after it's "END SUB"...... Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub hth Vaya con Dios, Chuck, CABGx3 "Larry" wrote: Hi Chuck, I found this handy bit of code IN Contextures samples. I managed to tweat it to do what I have been after. IN MODULE 1 I HAVE: Option Explicit Sub Workbook_Open() Columns("B:B").Select Range("B3").Activate ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="WAIVER%20NO.xls", _ TextToDisplay:="" End If Else End If End Sub NO SHEET 1OR2 IN SHEET 3 (LISTS)I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Columns(1).Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom End Sub IN SHEET 4(86x36236; an auto number) I HAVE: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next Dim ws As Worksheet Dim i As Integer Set ws = Worksheets("Lists") If Target.Column = 3 And Target.Row 1 Then If Application.WorksheetFunction.CountIf(ws.Range("Na meList"), Target.Value) Then Exit Sub Else i = ws.Cells(Rows.Count, 1).End(xlUp).Row + 1 ws.Range("A" & i).Value = Target.Value ws.Range("NameList").Sort Key1:=ws.Range("A1"), _ Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom End If End If End Sub THIS WORKS GREAT IN AUTO UPDATING MY LIST BUT I CANNOT GET THE DATE ENTRY CODE TO PLAY WITH THE OTHER CODE. I AM ASSUMING I NEED TO HAVE IT IN SHEET MODULE 4 WHERE ALL THE WORK IS BEING DONE? I WANT TO ADD THE FOLLOWING CODE YOU PROVIDED; HELP?? If ActiveCell.Column = 3 Then 'Limits macro action to column C If ActiveCell.Value = "" Then 'Check to see if Target cell empty Selection.Value = Date 'Insert today's date in Target cell Else End If Else End If End Sub |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding info to query | mjj4golf | Running & Setting Up Queries | 20 | January 9th, 2006 02:29 AM |
Copy Cat Ain't Working | shep | Setting Up & Running Reports | 15 | September 12th, 2005 05:14 PM |
Query for 'confirmation' | rogge | Running & Setting Up Queries | 8 | April 19th, 2005 03:26 PM |
Automatically Insert DATE, so that DATE will NOT change | Cie | Worksheet Functions | 4 | April 4th, 2005 05:51 PM |
Aggregating Date Data into Weeks and Quarters | Roger | Running & Setting Up Queries | 3 | July 11th, 2004 05:56 PM |