Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default need to copy row above but different thoughtout data

I am needing to look through varying rows of data looking for empt
cells in col B-I. If blanks are found on that row in all colums B-I
need it to copy columns B-I right above it and paste it in that row
Once done it will need to keep on till it finds the next empty colum
sets. I hope this is descriptive enough.
Michae

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default need to copy row above but different thoughtout data

something like this (untested)
for i = cells(rows.count,"a").end(xlup).row to 2 step -1
if application.countif(range(cells(i,"b"),cells(i,"I" ))=0 then
rows(i-1).copy rows(i)
end if
next i

--
Don Guillett
SalesAid Software

"Michael Wise " wrote in
message ...
I am needing to look through varying rows of data looking for empty
cells in col B-I. If blanks are found on that row in all colums B-I I
need it to copy columns B-I right above it and paste it in that row.
Once done it will need to keep on till it finds the next empty column
sets. I hope this is descriptive enough.
Michael


---
Message posted from
http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default need to copy row above but different thoughtout data

Sub AAtester1()
lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.R ows.Count).Row
For i = 2 To lastrow
If Application.CountA(Cells(i, 2).Resize(1, 9)) = 0 Then
Cells(i, 2).Resize(1, 9).FillDown
End If
Next
End Sub


--
Regards,
Tom Ogilvy




"Michael Wise " wrote in
message ...
I am needing to look through varying rows of data looking for empty
cells in col B-I. If blanks are found on that row in all colums B-I I
need it to copy columns B-I right above it and paste it in that row.
Once done it will need to keep on till it finds the next empty column
sets. I hope this is descriptive enough.
Michael


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default need to copy row above but different thoughtout data

Michael,

Perhaps doing them all at once?

Select your table, then use Edit | Go To... Special Blanks, press OK.
Then type and = sign, hit the up arrow key once, then press Ctrl-Enter.

That will fill all blanks with the values above them. You can copy
pastespecial values to change the formulas to values if you don't want the
formulas.

HTH,
Bernie
MS Excel MVP

"Michael Wise " wrote in
message ...
I am needing to look through varying rows of data looking for empty
cells in col B-I. If blanks are found on that row in all colums B-I I
need it to copy columns B-I right above it and paste it in that row.
Once done it will need to keep on till it finds the next empty column
sets. I hope this is descriptive enough.
Michael


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default need to copy row above but different thoughtout data

Just a not to Michael as I thought about this approach as well - but it does
not just work on rows where columns B to I are all empty. If just G10 were
empty in row 10, it would get filled as well.

If there is no situation like that and if one cell in those columns is blank
then all cells in those columns are blank than Bernies suggestion is the
fastest way to do it.

You would have to select the whole range to do the copy and pastespecial
values, so if that is a requirement, if other cells might have formulas,
this would overwrite them as well. Just a point to consider as well.

--
Regards,
Tom Ogilvy



"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Michael,

Perhaps doing them all at once?

Select your table, then use Edit | Go To... Special Blanks, press OK.
Then type and = sign, hit the up arrow key once, then press Ctrl-Enter.

That will fill all blanks with the values above them. You can copy
pastespecial values to change the formulas to values if you don't want the
formulas.

HTH,
Bernie
MS Excel MVP

"Michael Wise " wrote in
message ...
I am needing to look through varying rows of data looking for empty
cells in col B-I. If blanks are found on that row in all colums B-I I
need it to copy columns B-I right above it and paste it in that row.
Once done it will need to keep on till it finds the next empty column
sets. I hope this is descriptive enough.
Michael


---
Message posted from http://www.ExcelForum.com/







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default need to copy row above but different thoughtout data

Don Guillett wrote:
[b]something like this (untested)
for i = cells(rows.count,"a").end(xlup).row to 2 step -1
if application.countif(range(cells(i,"b"),cells(i,"I" ))=0 then
rows(i-1).copy rows(i)
end if
next i

Don,
On this one i'm getting an Invalid number of arguments. I did notic
a typo right after 'cells(i,"I"))' I had to add another ) I hope i
was the right spot.

Tom,
Don't know if I was missing something on yours but when it got t
this point in the script it did nothing. I'm new at this so could no
see where I could come up with anything to spark it.

Awaiting more food *smile* thanks for the help.
Michae


--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default need to copy row above but different thoughtout data

Code was tested and worked perfectly for me.

you statement about getting to this point in the script is meaningless.

Only problem I would be able to see would be if you had no rows that were
actually blank in columns B to I

Don's countif function continues to be broken since it doesn't have a second
argument and he is copying the entire row above, but maybe that is what you
wanted.


--
Regards,
Tom Ogilvy

"Michael Wise " wrote in
message ...
Don Guillett wrote:
[b]something like this (untested)
for i = cells(rows.count,"a").end(xlup).row to 2 step -1
if application.countif(range(cells(i,"b"),cells(i,"I" ))=0 then
rows(i-1).copy rows(i)
end if
next i

Don,
On this one i'm getting an Invalid number of arguments. I did notice
a typo right after 'cells(i,"I"))' I had to add another ) I hope it
was the right spot.

Tom,
Don't know if I was missing something on yours but when it got to
this point in the script it did nothing. I'm new at this so could not
see where I could come up with anything to spark it.

Awaiting more food *smile* thanks for the help.
Michael



---
Message posted from http://www.ExcelForum.com/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default need to copy row above but different thoughtout data

Tom,
To clarify, yes it will actually be the whole row up to col I that al
cells will be blank. I would appear at first something like this

P02 SDOSR STORE LPG 50492471 SRSTVEP-07 PIPING EXINSP 1-May-08

XXX XXXXX XXXXX XXX XXXXXXXX XXXXXXXXX XXXXXX VISIN1 1-Nov-05

the "X" here represent what cells would be blank for sake of example.
spaces here represent each cell break. I have existing data pretainin
to the same item right above it I need that copied. Although not ever
line will be blank. But where those lines are blank up to col. I th
information is needed below. And it is only where all col B-I are blan
this is needed

--
Message posted from http://www.ExcelForum.com

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default need to copy row above but different thoughtout data

Then I miscounted the number of cells between B and I inclusive. the
adjustment would be:

Sub AAtester1()
lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.R ows.Count).Row
For i = 2 To lastrow
If Application.CountA(Cells(i, 2).Resize(1, 8)) = 0 Then
' copy down A to I
Cells(i, 1).Resize(1, 9).FillDown
End If
Next
End Sub

--
Regards,
Tom Ogilvy



"Michael Wise " wrote in
message ...
Tom,
To clarify, yes it will actually be the whole row up to col I that all
cells will be blank. I would appear at first something like this

P02 SDOSR STORE LPG 50492471 SRSTVEP-07 PIPING EXINSP 1-May-08

XXX XXXXX XXXXX XXX XXXXXXXX XXXXXXXXX XXXXXX VISIN1 1-Nov-05

the "X" here represent what cells would be blank for sake of example.
spaces here represent each cell break. I have existing data pretaining
to the same item right above it I need that copied. Although not every
line will be blank. But where those lines are blank up to col. I the
information is needed below. And it is only where all col B-I are blank
this is needed.


---
Message posted from http://www.ExcelForum.com/



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
How copy none excel data & paste in 2007 without overwriting data Wakefootin Excel Discussion (Misc queries) 2 October 8th 09 12:15 AM
filted data, copy and paste a col. puts data in wrong row how fix chris_fig New Users to Excel 1 October 16th 06 04:26 PM
Retrieve multiple data rows data from a very long list and copy t mathew Excel Discussion (Misc queries) 1 September 13th 06 08:24 PM
How do I copy data from main frame computer and keep data in cell Doug Excel Worksheet Functions 1 May 30th 06 05:15 PM
Copy old Data from web query while keeping previous days data DRobidoux Excel Worksheet Functions 0 March 22nd 06 01:56 PM


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