Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Find value in a column and insert rows above

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this order.
I need to find the first Y in each column and insert 2 rows above that row.
On the blank row above the first Y, I need to highlight in yellow and put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Find value in a column and insert rows above

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Dee Sperling" wrote in message
...
The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this
order.
I need to find the first Y in each column and insert 2 rows above that
row.
On the blank row above the first Y, I need to highlight in yellow and put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Find value in a column and insert rows above

You didn't specify the "rules" for what titles to use, so this routine does
what you asked byt just puts the word "Title" in the yellow cell:

Sub InsertY()
For col = 21 To 24
rw = Columns(col).Find("Y").Row
Cells(rw, col).Resize(2).Insert shift:=xlDown
Cells(rw + 1, col).Interior.Color = vbYellow
Cells(rw + 1, col).Value = "Title"
Next
End Sub

Bob Umlas
Excel MVP

"Dee Sperling" wrote:

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this order.
I need to find the first Y in each column and insert 2 rows above that row.
On the blank row above the first Y, I need to highlight in yellow and put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Find value in a column and insert rows above

The titles will be New, Old, Existing, Deleted in that order from U to X.
Sorry I didn't make that clearer.

I put the code in my module but I get Run-time errro '91":
Opject variable or With block variable not set

I'm using Excel 2003, is that the cause?

"Bob Umlas, Excel MVP" wrote:

You didn't specify the "rules" for what titles to use, so this routine does
what you asked byt just puts the word "Title" in the yellow cell:

Sub InsertY()
For col = 21 To 24
rw = Columns(col).Find("Y").Row
Cells(rw, col).Resize(2).Insert shift:=xlDown
Cells(rw + 1, col).Interior.Color = vbYellow
Cells(rw + 1, col).Value = "Title"
Next
End Sub

Bob Umlas
Excel MVP

"Dee Sperling" wrote:

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this order.
I need to find the first Y in each column and insert 2 rows above that row.
On the blank row above the first Y, I need to highlight in yellow and put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Find value in a column and insert rows above

It would probably help if I specified which line it stops on:
rw = Columns(col).Find("Y").Row

"Dee Sperling" wrote:

The titles will be New, Old, Existing, Deleted in that order from U to X.
Sorry I didn't make that clearer.

I put the code in my module but I get Run-time errro '91":
Opject variable or With block variable not set

I'm using Excel 2003, is that the cause?

"Bob Umlas, Excel MVP" wrote:

You didn't specify the "rules" for what titles to use, so this routine does
what you asked byt just puts the word "Title" in the yellow cell:

Sub InsertY()
For col = 21 To 24
rw = Columns(col).Find("Y").Row
Cells(rw, col).Resize(2).Insert shift:=xlDown
Cells(rw + 1, col).Interior.Color = vbYellow
Cells(rw + 1, col).Value = "Title"
Next
End Sub

Bob Umlas
Excel MVP

"Dee Sperling" wrote:

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this order.
I need to find the first Y in each column and insert 2 rows above that row.
On the blank row above the first Y, I need to highlight in yellow and put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find value in a column and insert rows above

As structured, the code expects you to have the worksheet with your Y's and
N's as the active worksheet. Go back and select that worksheet and then try
running the code again.

--
Rick (MVP - Excel)



"Dee Sperling" wrote in message
...
It would probably help if I specified which line it stops on:
rw = Columns(col).Find("Y").Row

"Dee Sperling" wrote:

The titles will be New, Old, Existing, Deleted in that order from U to X.
Sorry I didn't make that clearer.

I put the code in my module but I get Run-time errro '91":
Opject variable or With block variable not set

I'm using Excel 2003, is that the cause?

"Bob Umlas, Excel MVP" wrote:

You didn't specify the "rules" for what titles to use, so this routine
does
what you asked byt just puts the word "Title" in the yellow cell:

Sub InsertY()
For col = 21 To 24
rw = Columns(col).Find("Y").Row
Cells(rw, col).Resize(2).Insert shift:=xlDown
Cells(rw + 1, col).Interior.Color = vbYellow
Cells(rw + 1, col).Value = "Title"
Next
End Sub

Bob Umlas
Excel MVP

"Dee Sperling" wrote:

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this
order.
I need to find the first Y in each column and insert 2 rows above
that row.
On the blank row above the first Y, I need to highlight in yellow and
put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Find value in a column and insert rows above

It is running on the active sheet, it goes once and inserts a cell rather
than a row, then stops with the error.
The result in the spreadsheet looks like this:
New Old Existing Deleted
N N N
Title N N N
Y N N N
Y N N N
Y N N N
N Y N N
N N Y N
N N N Y
N N N Y


"Rick Rothstein" wrote:

As structured, the code expects you to have the worksheet with your Y's and
N's as the active worksheet. Go back and select that worksheet and then try
running the code again.

--
Rick (MVP - Excel)



"Dee Sperling" wrote in message
...
It would probably help if I specified which line it stops on:
rw = Columns(col).Find("Y").Row

"Dee Sperling" wrote:

The titles will be New, Old, Existing, Deleted in that order from U to X.
Sorry I didn't make that clearer.

I put the code in my module but I get Run-time errro '91":
Opject variable or With block variable not set

I'm using Excel 2003, is that the cause?

"Bob Umlas, Excel MVP" wrote:

You didn't specify the "rules" for what titles to use, so this routine
does
what you asked byt just puts the word "Title" in the yellow cell:

Sub InsertY()
For col = 21 To 24
rw = Columns(col).Find("Y").Row
Cells(rw, col).Resize(2).Insert shift:=xlDown
Cells(rw + 1, col).Interior.Color = vbYellow
Cells(rw + 1, col).Value = "Title"
Next
End Sub

Bob Umlas
Excel MVP

"Dee Sperling" wrote:

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this
order.
I need to find the first Y in each column and insert 2 rows above
that row.
On the blank row above the first Y, I need to highlight in yellow and
put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee


.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Find value in a column and insert rows above

Would help if I said what line it stops on:
rw = Columns(col).Find("Y").Row


"Bob Umlas, Excel MVP" wrote:

You didn't specify the "rules" for what titles to use, so this routine does
what you asked byt just puts the word "Title" in the yellow cell:

Sub InsertY()
For col = 21 To 24
rw = Columns(col).Find("Y").Row
Cells(rw, col).Resize(2).Insert shift:=xlDown
Cells(rw + 1, col).Interior.Color = vbYellow
Cells(rw + 1, col).Value = "Title"
Next
End Sub

Bob Umlas
Excel MVP

"Dee Sperling" wrote:

The set up looks like this:
ColU ColV ColW ColX
Y N N N
Y N N N
N Y N N
N N Y N
N N Y N
N N Y N
N N Y N
N N Y Y

Columns will always be U through X and will always be sorted in this order.
I need to find the first Y in each column and insert 2 rows above that row.
On the blank row above the first Y, I need to highlight in yellow and put
title in the first cell, such as New, Old, Existing, Deleted.

Any help would be greatly appreciated.

Thanks for your time,
Dee

Reply
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
insert rows and copying cells in column b,c, and d into new rows gbpg Excel Programming 0 December 31st 09 12:34 AM
FInd value and insert rows below vlad Excel Programming 1 September 20th 07 11:22 AM
find number & insert rows Steve Wallis Excel Programming 4 March 21st 06 05:48 PM
Need Macro to Find Column Heading -- if none, then insert new column Jeff[_43_] Excel Programming 0 December 15th 04 07:08 AM
find row value, insert column gaba Excel Programming 0 October 18th 04 06:59 PM


All times are GMT +1. The time now is 01:29 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"