Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have a macro that copy pastes rows. This works fine if I run it from the Run Macro inside excel. I tried to make a function and call it from the function, but it does nothing? It steps through but changes nothing on the sheet. It is like it can't find the sheet cell has formula =check4diff(B6,B5) Function check4diff(Old_Value, New_Value) If Old_Value=New_Value Then check4diff=1 Else Application.Run("insertrowandcopy") ' I also tried the Call syntax and it was no different check4diff=2 End If End Function Sub insertrowandcopy() Worksheets("Sheet1").Activate Worksheets("Sheet1").Rows(5).Copy Worksheets("Sheet1").Rows(7).Select Selection.Insert Shift:=xlDown End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Brenda" wrote in message ... I have a macro that copy pastes rows. This works fine if I run it from the Run Macro inside excel. I tried to make a function and call it from the function, but it does nothing? It steps through but changes nothing on the sheet. It is like it can't find the sheet cell has formula =check4diff(B6,B5) Function check4diff(Old_Value, New_Value) If Old_Value=New_Value Then check4diff=1 Else Application.Run("insertrowandcopy") ' I also tried the Call syntax and it was no different check4diff=2 End If End Function Sub insertrowandcopy() Worksheets("Sheet1").Activate Worksheets("Sheet1").Rows(5).Copy Worksheets("Sheet1").Rows(7).Select Selection.Insert Shift:=xlDown End Sub "It steps through but changes nothing on the sheet" because worksheet functions are not allowed to change anything in any worksheet. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Why macro runs on the same sheet? | Excel Discussion (Misc queries) | |||
One macro runs then it auto runs another macro | Excel Discussion (Misc queries) | |||
Which Macro Runs...? | Excel Discussion (Misc queries) | |||
Macro Runs if Template name is ..... | Excel Programming |