Ignore blank cells

hezcal11

Board Regular
Joined
Jan 20, 2012
Messages
57
Hello,
I currently have a programme excel 2010 that allows people to enter their shift availability for the month which is then transferred to a master sheet on another sharepoint area. I am trying to automate it so that it can be changed each month without too much hassle. The problem I have is that the first of each month is usually a different day so when I transfer the information it can move out of synch with the master table. I have a table to explain. On this particular month the first is a wednesday, so when I transfer this information over I need the box with the x in it to be the first box on the new table, that is ignore the two yellow cells. This can only be for the first cells as there will be blank cells in the availability, the 3rd for example, but I need these gaps to remain.
I hope someone can help. I have probably made it sound more complicated than it is.

Thanks


Colin

M
T
W
T
F
S
S
1st
2nd
3rd
4th
5th
X
E
B
E

<TBODY>
</TBODY>

WTFSS
1st2nd3rd4th5th
XEEB

<COLGROUP><COL style="WIDTH: 48pt" span=5 width=64><TBODY>
</TBODY>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Possibly something like below (please note I have assumed that you already have the top row in sheet 2 filled out and that you made a typo in your post and the order in the second table should be XEBE not XEEB).
Change the sheetnames to suit.

Code:
Sub XXX()
    Dim LstRw As Long, i As Long
    LstRw = Sheets("Sheet1").Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
    For i = 2 To LstRw
        Sheets("Sheet1").Rows(i).SpecialCells(xlCellTypeConstants, 23).Copy Sheets("Sheet2").Range("A" & Sheets("Sheet2").Rows.Count).End(xlUp).Offset(1)
    Next
End Sub
 
Last edited:
Upvote 0
Possibly something like below (please note I have assumed that you already have the top row in sheet 2 filled out and that you made a typo in your post and the order in the second table should be XEBE not XEEB).
Change the sheetnames to suit.

Code:
Sub XXX()
    Dim LstRw As Long, i As Long
    LstRw = Sheets("Sheet1").Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
    For i = 2 To LstRw
        Sheets("Sheet1").Rows(i).SpecialCells(xlCellTypeConstants, 23).Copy Sheets("Sheet2").Range("A" & Sheets("Sheet2").Rows.Count).End(xlUp).Offset(1)
    Next
End Sub

Thanks will give it a try. I'm amazed you could understand my ramblings!!!
 
Upvote 0
Actually after reading it again I don't think the macro will work for you as I think you meant your second table to look like...
Excel Workbook
ABCDE
1WTFSS
21st2nd3rd4th5th
3XEBE
Sheet4
 
Upvote 0
If my reading of the post is now correct try the code below on a copy of your workbook.

Code:
Sub XXX()
    Dim LstRw As Long, i As Long, lstCo As Long, x As Long, LstRW2 As Long
    Application.ScreenUpdating = 0

    With Sheets("Sheet1")

        LstRw = .Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row
        lstCo = .Cells.Find(What:="*", SearchOrder:=xlColumns, SearchDirection:=xlPrevious, LookIn:=xlValues).Column

        x = .Rows(2).Find(What:="1st", After:=.Cells(2, lstCo), LookIn:=xlValues, _
                          LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext).Column

        LstRW2 = Sheets("Sheet2").Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

        For i = 3 To LstRw

            .Range(.Cells(i, x), .Cells(i, lstCo)).Copy Sheets("Sheet2").Cells(LstRW2, 1)
            LstRW2 = LstRW2 + 1
        Next
    
    End With

    Application.ScreenUpdating = 1
End Sub
 
Upvote 0
I was too late to add this as an edit to my last post. :(

Obviously it is assuming you have the first 2 rows in Sheet2 already and please note that it searches for the text "1st" in Row 2 , Sheet1 so make sure that is your exact wording.
 
Upvote 0
I will adjust and try again. I did make a `mistake in the second table. Thanks for taking the time to amend it.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top