Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
exit macro after test of cell value
I want a macro executed from a certain row only. Other parts of macro are
copied from knowledge base. So far so good! My knowledge of Vbasic is not enough therefore my question to you to write one statement: IF etc.... Macro: Sub Extra3lines() Dim c As Range 'the cell is saved as variable Set c = Selection 'In cell ADx is the row number - ADx is in same row as c 'Exit macro when row number of c is not equal to value in cell ADx ' If c < ADx then End sub << I am looking for correct syntax 'insert 3 rows above selected row Range(c, c.Offset(2, 0)).EntireRow.Insert 'force saving sheet with new name - once per month ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My Documents\VvEAH\2007\VvEAH_Bookdoc Expl " & Format(Now, "yyyy-mm") & ".xls" End Sub Thanks for your help |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run a macro on exit | Excel Programming | |||
Run macro on exit | Excel Discussion (Misc queries) | |||
Macro on exit cell | Excel Discussion (Misc queries) | |||
How to test cell contents in a macro? | Excel Programming | |||
Run Macro on cell exit | Excel Programming |