LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Nested if statements / comparing two adjacent cells and inserting row

Hello,

Well at this point I have just under 500 lines of code and I am stuck on this
one little part. I have the majority of my macro set up to run off of
specific cells in multiple worksheets and I need to make sure that the
worksheets are formated the same to extract the necessary data.

In column A there are two instances of when I need to insert a blank row.
1. When "ES 2" is Followed by "PP 1"
2. When "PP 4" is Followed by "Totals"
** Because the individuals who invented this worksheet didn't think about
data migration the "PP" is sometimes neglected and it is just the numeric
value

Additionally, these values will appear in the same worksheet and workbook
multiple and varying times - so I think I need to use a loop or an interger
to achieve everything I need.

Please take a look at the code below and any help will be greatly appreciated.


Sub my_headache()

Dim rng As Range
Dim i As Integer
i = 1
Dim r As Integer
r = 1

rng = Columns("A:A")
For Each cell In rng
If (Right(Cells.Name(i, 1), 1)) = "2" Then
rng.Offset(1, 0)
If (Right(Cells.Name(r, 2), 1)) = "1" Then
Rows(i + 1).EntireRow.Insert
End If
End If
Next i

End Sub



Thanks,
Reign

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel formulas - comparing adjacent cells Bryan Gnidrah[_2_] Excel Worksheet Functions 5 August 13th 09 06:53 PM
Nested if statements JICDB Excel Worksheet Functions 2 November 20th 07 06:48 PM
nested if statements tjb Excel Worksheet Functions 1 March 28th 07 01:09 AM
Nested IF statements maacmaac Excel Discussion (Misc queries) 3 January 24th 06 12:00 AM
Do I need nested IF statements? Jaramya Excel Worksheet Functions 1 November 5th 04 09:10 PM


All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"