Copy data from worksheets to master sheet

Closed
meetmoras
Posts
1
Registration date
Sunday July 21, 2013
Status
Member
Last seen
July 21, 2013
- Jul 21, 2013 at 01:46 AM
TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
- Jul 23, 2013 at 11:53 AM
Hi,

I have one input workbook with multiple worksheets(all are with same table format) and I have to look in to each worksheet and if there value then it should select a range of values and paste the same to master Sheet and if no value then it should look for next worksheet and this should happen till the end worksheet in the input sheet.

I have attached a sample worksheets with code bu its not working propperly

hope any one of u can solve this problem

Sub testtest()
'

'
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
If IsNumeric([A8]) Then
    Range("A8").Select
    Range(ActiveCell, ActiveCell.Offset(0, 4)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Windows("output report.xlsm").Activate
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    End If

Next ws
End Sub


In input sheet the default cell range be same for all worksheets. If that perticuler cell is not having value it should skip the worksheet and look at next worksheet

Thanks,
NM

1 reply

TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
509
Jul 23, 2013 at 11:53 AM
Hi Meetmoras,

If you want to check if cell A8 is empty instead of checking if it's numeric then use:
If [A8]<>vbNullString Then


What is not working properly? I'm missing your sample file.
Are you left with only the results from you last sheet?

Please be clear as to what the problem is.

Best regards,
Trowa
0