Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Making Sub MakeMaster work

Re-posting this afresh for help here (from a thread in .worksheet.functions)
since it received no replies over there for several days past.

I hit some problems trying out Joel's Sub MakeMaster() below

Prepared this sample set-up
with 3 sheets: Cat1, Cat2, Master

In sheet: Cat1

Qty Part# ProdDesc
b ... 10 Dat11
2 ... 10 Dat12
5 ... 15 Dat13

In sheet: Cat2

Qty Part# ProdDesc
1 ... 14 Dat21
b ... 15 Dat22
3 ... 17 Dat23

where b = blank (no qty was input)

Then in sheet: Master,
started with only the headers in A1:C1

Qty Part# ProdDesc

When the sub is run, the expected
results would be something like this:

Qty Part# ProdDesc
2 10 Dat12
5 15 Dat13
1 14 Dat21
3 17 Dat23

But when I ran Joel's sub, I got this in Master,
it hung so I CTRL+Breaked it

Qty Field1 Desc
1 14 Dat21
1 14 Dat21
1 14 Dat21
(Repeat interminably ...)

How can it be made to produce the expected results?

Thanks
Max

---------------
Sub MakeMaster()
'Joel
Set MasterSht = Sheets("Master")

NewRow = 2
For Each sht In Worksheets
If UCase(sht.Name) < "MASTER" Then
RowCount = 2
Do While sht.Range("A" & RowCount) < ""
If sht.Range("A" & RowCount) 0 Then
sht.Rows(RowCount).Copy _
Destination:=MasterSht.Rows(NewRow)
NewRow = NewRow + 1
End If
Loop
End If
Next sht
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Making Sub MakeMaster work

Sub MakeMaster()
Dim MasterSht As Worksheet
Dim sht As Worksheet
Dim Newrow As Long
Dim RowCount As Long

Set MasterSht = Worksheets("Master")

Newrow = 2
For Each sht In Worksheets

If UCase(sht.Name) < "MASTER" Then

RowCount = 2
Do While sht.Range("B" & RowCount).Value < ""

If sht.Range("A" & RowCount).Value 0 Then

sht.Rows(RowCount).Copy _
Destination:=MasterSht.Rows(Newrow)
Newrow = Newrow + 1
End If
RowCount = RowCount + 1
Loop
End If
Next sht
End Sub



--
__________________________________
HTH

Bob

"Max" wrote in message
...
Re-posting this afresh for help here (from a thread in
.worksheet.functions) since it received no replies over there for several
days past.

I hit some problems trying out Joel's Sub MakeMaster() below

Prepared this sample set-up
with 3 sheets: Cat1, Cat2, Master

In sheet: Cat1

Qty Part# ProdDesc
b ... 10 Dat11
2 ... 10 Dat12
5 ... 15 Dat13

In sheet: Cat2

Qty Part# ProdDesc
1 ... 14 Dat21
b ... 15 Dat22
3 ... 17 Dat23

where b = blank (no qty was input)

Then in sheet: Master,
started with only the headers in A1:C1

Qty Part# ProdDesc

When the sub is run, the expected
results would be something like this:

Qty Part# ProdDesc
2 10 Dat12
5 15 Dat13
1 14 Dat21
3 17 Dat23

But when I ran Joel's sub, I got this in Master,
it hung so I CTRL+Breaked it

Qty Field1 Desc
1 14 Dat21
1 14 Dat21
1 14 Dat21
(Repeat interminably ...)

How can it be made to produce the expected results?

Thanks
Max

---------------
Sub MakeMaster()
'Joel
Set MasterSht = Sheets("Master")

NewRow = 2
For Each sht In Worksheets
If UCase(sht.Name) < "MASTER" Then
RowCount = 2
Do While sht.Range("A" & RowCount) < ""
If sht.Range("A" & RowCount) 0 Then
sht.Rows(RowCount).Copy _
Destination:=MasterSht.Rows(NewRow)
NewRow = NewRow + 1
End If
Loop
End If
Next sht
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Making Sub MakeMaster work

Bob,

That was marvellous. Runs great.
Many thanks for your help.

Max


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
Making a formula Work.... PZ[_2_] Excel Programming 2 October 1st 08 07:02 PM
Making this formula work Kleev Excel Worksheet Functions 5 December 15th 05 12:42 AM
Making VBA code from one WB work on another WB ForestRamsey Excel Programming 2 December 6th 05 05:39 PM
making a userform work ,oops scott t Excel Programming 2 April 26th 04 12:51 AM
making a userform work scott t Excel Programming 0 April 25th 04 11:11 PM


All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"