Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter code by a macro
Is it possible to create a macro to enter code via a Macro :
Sub Worksheet_SelectionChange(ByVal Target As Range) ' Enter code here via a Macro? End Sub If so how? I have copied the code to another module named Replace VBA. But how can i copy the code from there to the WorkSheet_SelectionChange event by a macro? I had a mass of code in the Worksheet_SelectionChange event, but found a copy/paste error was generated because some of the cells were also in the Worksheet_SelectionChange. So i figured(IF POSSIBLE), i could have the Worksheet_SelectionChange empty, until AFTER the Copy/Paste macro is run, then repopulate the Worksheet_SelectionChange with the code from the ReplaceVBA. Corey.... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enter code by a macro
It is possible to write code that writes code. Chip Pearson shows how he
http://www.cpearson.com/excel/vbe.aspx But this will only mask your problem until someone does a copy|paste the same way your code does. You could tell excel to stop looking for selection changes: application.enableevents = false 'your code to copy application.enableevents = true But this is only masking the problem, too. I think I'd try to fix the code. Corey wrote: Is it possible to create a macro to enter code via a Macro : Sub Worksheet_SelectionChange(ByVal Target As Range) ' Enter code here via a Macro? End Sub If so how? I have copied the code to another module named Replace VBA. But how can i copy the code from there to the WorkSheet_SelectionChange event by a macro? I had a mass of code in the Worksheet_SelectionChange event, but found a copy/paste error was generated because some of the cells were also in the Worksheet_SelectionChange. So i figured(IF POSSIBLE), i could have the Worksheet_SelectionChange empty, until AFTER the Copy/Paste macro is run, then repopulate the Worksheet_SelectionChange with the code from the ReplaceVBA. Corey.... -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to enter a value, tab to next cell in the row, enter ... | Excel Programming | |||
Macro to enter a value, tab to next cell in the row, enter ... | Excel Programming | |||
NOT ABLE TO ENTER VB CODE | Excel Programming | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet | Excel Programming |