Home |
Search |
Today's Posts |
#12
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
exactly.
Then "print ks2" will be treated the same as "PrinT KS2" or "PRINT ks2" or ... LesG wrote: Hi Dave... this is quite handy. Am I correct in assuming that the "lcase(Target.value)" forces the target value to be lowercase? "Dave Peterson" wrote: Actually, I wouldn't use Activecell. I'd use the variable that was passed to the procedure (Target). And I'd make sure that the case didn't matter: if lcase(Target.value) = lcase("print ks2") then LesG wrote: sorry my keyboard (and the fact that I have been watching rugby) are not conducive to coherent sentences... the remarks bellow sould have been... The "SelectionChange" part of the statement refers to any movement when you move from the the cuurent cell in a workbook... The command then works on the ACTIVECELL statement. You MUDT not use the word "maro" after Printks2... To be 100% correct you could say : If ActiveCell.Value = "Print KS2" Then call Printks2 End If "LesG" wrote: Hi RR1, The "SelectionChange" part of the statement refers to any movemen twhen you move from the the cuurent cell... The command then works on the ACTIVE cell. need the word "maro" after .. you do not need the wor macro after Printks2... to be 100% correct you could say : If ActiveCell.Value = "Print KS2" Then call Printks2 End If hope this helps.. Regards Les "Romileyrunner1" wrote: Hi, LesG Can you see what I`m doing wrong? It doesn`t seem to be woking for me! I`ve typed the following along with my other macros. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Value = "Print KS2" Then Printks2 Macro End If End Sub Printks2 is the name of the macro I want to use. (should I not put the word Macro after it?) I have entered Print KS2 in a blank cell. When I double click in it, it just wants to edit the typing. Do I need to do something else to that cell? Also, because the Macro begins "Private Sub Worksheet..." will others be able to use this; is it part of this worksheet? Thanks, LesG RR1 "LesG" wrote: assuming you are going to replace controls (buttons) with lables in cells, press Alt F11 an insert (and amend) the following in the worksheet... Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Value = "value in cell" Then macroname End If End Sub hope this helps, if so click yes "Romileyrunner1" wrote: Hi, have a number of macros wrtten that are currently activated by buttons on top of cells. Here is one such macro: Sub Printall() ' ' Printall Macro ' Macro recorded 17/09/2009 by User ' ' Range("A10:CF53").Select ActiveSheet.PageSetup.PrintArea = "$A$10:$CF$53" Range("A1").Select End Sub How do I use this to now change to just a cell (double-click) activated macro? Do I enter the sheet name and cell reference somewhere? Have read the following from an earlier question but frankly don`t follow it!!! Sorry The following in the Worksheet Selection Change event should do the trick Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("B4")) Is Nothing Then Range("B4") ="24" End Sub Thanks RR1 -- Dave Peterson -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clicking on cell | Excel Discussion (Misc queries) | |||
Run a macro when clicking a cell. | Excel Worksheet Functions | |||
Run a macro after clicking into cell | Excel Worksheet Functions | |||
Using Macro to sort without clicking on macro button | Excel Discussion (Misc queries) | |||
Run macro from clicking on a cell | Excel Discussion (Misc queries) |