Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi again,
Is there a way to tweak this macro so that the formatting in the cell on the CTD sheet matches that of the same cell on the Data Entry sheet? When data get entered, sometimes it needs to be center justified and sometimes it needs to be right justified, and significant figures change too. Thanks. Frank On Fri, 15 Apr 2011 20:05:33 -0700, "Jim Cone" wrote: It is good practice to use Option Explicit and declare all variables. In worksheet event code "Target" is the active cell. Qualify all ranges with the parent sheet (and the workbook if there is more than one). The following code is untested but should be close to what you want... '--- Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim myActiveCell As String Dim myFormula As String myActiveCell = Target(1).Address(False, False) myFormula = Sheets("CTD").Range(myActiveCell).FormulaR1C1 If InStr(1, myFormula, "=IF(ISERROR", vbTextCompare) Then Sheets("Data Entry").Select Else Sheets(Array("Data Entry", "CTD")).Select End If End Sub '--- Jim Cone Portland, Oregon USA . http://www.mediafire.com/PrimitiveSoftware . (Determine Colors (excel add-in) - in the free folder) "Phrank" wrote in message .. . I tried the Worksheet_Change event, and that's no good because it initiated the macro every time I even selected a cell. There are only two sheets in each workbook. ...well, there's actually a 3rd worksheet (Notes) with notes as to what to do under certain circumstances. This 3rd sheet is helpful, too, with my code, because if for some reason someone wants to access the CTD sheet, all they need to do is click on the Notes tab to deselect the other two tabs, then the can select the CTD tab alone. That part works well. I just need it to be able to look at the analagous cell in the 2nd tab and press on with the macro. For some reason, it's working when tested outside of the Worksheet_SelectionChange event, but not working inside the event. Thanks. Frank |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting multiple tabs in VB | Excel Programming | |||
Selecting Page Tabs | Excel Discussion (Misc queries) | |||
Merging multiple worksheets (selective cells) | Excel Discussion (Misc queries) | |||
selecting spreadsheet using tabs? | Excel Discussion (Misc queries) | |||
selecting multiple sheet tabs and open another workbook | Excel Discussion (Misc queries) |