Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How copy none excel data & paste in 2007 without overwriting data | Excel Discussion (Misc queries) | |||
filted data, copy and paste a col. puts data in wrong row how fix | New Users to Excel | |||
Retrieve multiple data rows data from a very long list and copy t | Excel Discussion (Misc queries) | |||
How do I copy data from main frame computer and keep data in cell | Excel Worksheet Functions | |||
Copy old Data from web query while keeping previous days data | Excel Worksheet Functions |