Excel - Check rows for data, copy to new
Solved/Closed
Related:
- Excel - Check rows for data, copy to new
- Tmobile data check - Guide
- Check soft - Download - Finance
- Transfer data from one excel worksheet to another automatically - Guide
- Excel apk for pc - Download - Spreadsheets
- How to check if someone is spying on my whatsapp - Guide
1 response
So, after more poking around, I see people being scolded on other sites for not providing example code. Here's what I have so far... it's simple, and missing a few key steps - but it's there.
---
Sheets("Widget Sheet").Select
If Not IsEmpty("D31") Then
Range("B31:AI31").Select
Selection.Copy
Windows("Book2").Activate
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Windows("01-05-09 Widget.xls").Activate
ActiveWindow.Close
----
It looks to me like I need two loops, one for going through the UPCs, and one to advance my target sheet down the rows. For some reason I'm having a heck of a time getting a nice loop set up. I know there are always 17 rows (31-48), so I have a constant loopcount number as long as for each row it checks the space to see if it's empty. I can't quite figure out how to get the range to move down to D32, however. I'm considering just making copies of this little piece 17 times >.<
Also, if possible I'd like to be able to switch back (or not switch away) from the current book so I can close it and move (ala "ActiveWindow.Close") on to the next one automatically. So far in my poking I haven't seen any way to set a variable to mirror the book name, and every one is named differently. Does anyone know a way?
Copying column AI seems to work fine, even though it is protected (I can't even select it with the mouse).
Thanks!
Fuzzy
---
Sheets("Widget Sheet").Select
If Not IsEmpty("D31") Then
Range("B31:AI31").Select
Selection.Copy
Windows("Book2").Activate
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Windows("01-05-09 Widget.xls").Activate
ActiveWindow.Close
----
It looks to me like I need two loops, one for going through the UPCs, and one to advance my target sheet down the rows. For some reason I'm having a heck of a time getting a nice loop set up. I know there are always 17 rows (31-48), so I have a constant loopcount number as long as for each row it checks the space to see if it's empty. I can't quite figure out how to get the range to move down to D32, however. I'm considering just making copies of this little piece 17 times >.<
Also, if possible I'd like to be able to switch back (or not switch away) from the current book so I can close it and move (ala "ActiveWindow.Close") on to the next one automatically. So far in my poking I haven't seen any way to set a variable to mirror the book name, and every one is named differently. Does anyone know a way?
Copying column AI seems to work fine, even though it is protected (I can't even select it with the mouse).
Thanks!
Fuzzy
Jan 13, 2009 at 03:05 PM
Here's what I ended up with.
Dec 15, 2010 at 02:42 PM
If w.Name <> ThisWorkbook.Name Then
w.Close savechanges:=True
End If
Next w
Dec 15, 2010 at 02:53 PM
For c = 1 to 5 ' This would loop column A to E
For r = 31 to 48 ' This loops rows
Sheets("Your Sheet Name Here").Cells(r , c).select
' Add here what you need it to do i.e copy - paste
Next r
Next c