Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Friday, June 24, 2011

Run a Macro when data entered in a cell


In Excel worksheet do the following :-
  1. Click on the Developer tab.
  2. Click on the Visual Basic icon.
  3. On the left pane window, double click the sheet where you need your code to run.
  4. Now, at the top of the code window you will see... (General) with a drop down, and (Declarations) with a drop down.
  5. Click the drop down by (General) and select Worksheet.
  6. Now in the code window you will see.... Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  7. Remove the word "Selection". You want to remove "Selection" because that means when you click on a cell in the worksheet something will happen. You do not want
  8. that, you want to enter a value in D10. It should now read...Private Sub Worksheet_Change(ByVal Target As Range)
  9. Now this is where you want the code...



Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$10" Then 

Call MyMacro 

End If 

End Sub 

All files open in the same window in Microsoft Excel


Issue


I have a problem with Excel 2007. All my files open in the same window.

Solution

  • Go to explorer, choose tools, then folder options. Click the File Types tab.
  • Scroll down to the XLS extension. Click the Advanced button. Choose "open", then click the edit button.
  • At the end of the "Application used" entry, you'll probably see: /e
  • After this, add: "%1" (be sure to include the quotes.)
  • Then uncheck the "Use DDE" checkbox. Then click OK. (Windows re-checks it at some point for some reason, but it still works)
  • Click on OK
  • Now when you double-click a spreadsheet, it will open it in a new instance of Excel