ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Nasty IF Statement (https://www.excelbanter.com/excel-programming/367862-nasty-if-statement.html)

bodhisatvaofboogie

Nasty IF Statement
 
Okay :

On Error Resume Next
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
On Error GoTo 0

This works up to here.....this is what I'm trying to accomplish after I have
that selected.....

If the value of the cell is equal to 16 then insert 14 rows, if the value is
15 then insert 15 rows, if the value 14 then insert 16 rows, if the value is
13 then insert 17 rows...etc etc on down the list. It's a pretty nasty
sounding IF statement, how do I get something like that to work and what
would the code look like??? THANKS!!!

THANKS!!!!!

Barb Reinhardt

Nasty IF Statement
 
I can't help with the code, but it looks like you need to insert 30 - (value
of cell) rows. Is this correct?

"bodhisatvaofboogie" wrote:

Okay :

On Error Resume Next
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
On Error GoTo 0

This works up to here.....this is what I'm trying to accomplish after I have
that selected.....

If the value of the cell is equal to 16 then insert 14 rows, if the value is
15 then insert 15 rows, if the value 14 then insert 16 rows, if the value is
13 then insert 17 rows...etc etc on down the list. It's a pretty nasty
sounding IF statement, how do I get something like that to work and what
would the code look like??? THANKS!!!

THANKS!!!!!


JMB

Nasty IF Statement
 
Is this along the lines of what you're thinking?

Range(ActiveCell, ActiveCell(30 - _
ActiveCell.Value, 1)).EntireRow.Insert


"Barb Reinhardt" wrote:

I can't help with the code, but it looks like you need to insert 30 - (value
of cell) rows. Is this correct?

"bodhisatvaofboogie" wrote:

Okay :

On Error Resume Next
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
On Error GoTo 0

This works up to here.....this is what I'm trying to accomplish after I have
that selected.....

If the value of the cell is equal to 16 then insert 14 rows, if the value is
15 then insert 15 rows, if the value 14 then insert 16 rows, if the value is
13 then insert 17 rows...etc etc on down the list. It's a pretty nasty
sounding IF statement, how do I get something like that to work and what
would the code look like??? THANKS!!!

THANKS!!!!!


Barb Reinhardt

Nasty IF Statement
 
See JMBs response.

"bodhisatvaofboogie" wrote:

Okay :

On Error Resume Next
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
On Error GoTo 0

This works up to here.....this is what I'm trying to accomplish after I have
that selected.....

If the value of the cell is equal to 16 then insert 14 rows, if the value is
15 then insert 15 rows, if the value 14 then insert 16 rows, if the value is
13 then insert 17 rows...etc etc on down the list. It's a pretty nasty
sounding IF statement, how do I get something like that to work and what
would the code look like??? THANKS!!!

THANKS!!!!!



All times are GMT +1. The time now is 07:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com