Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
HJ HJ is offline
external usenet poster
 
Posts: 28
Default Macro assistance needed

I am a newbie to macros and was wondering if someone could help me with some
code to accomplish what I think is fairly simple to most of you. I'm trying
to create a master list by piecing together information from various sheets
off of an existing workbook.

What I would like to do is write a macro that would look at Sheet 1 and copy
rows 7,9,10,11 then I need to skip 16 rows and copy rows 23,25,26,27 then
skip 16 rows and copy rows 39,41,42,43 etc. I've tried autofilter but it
doesn't work well with the structure of the existing worksheet.

Does anyone have any suggestions? Thanks in advance.

HJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro assistance needed

Dim i as long, rng as range
i = 7
do while not isempty(cells(i,1))
set rng = union(cells(i,1),cells(i+2).Resize(3))
rng.Entirerow.copy destination:= _
Worksheets(2).Cells(rows.count,1).End(xlup)
i = i + 16
Loop

--
Regards
Tom Ogilvy


"HJ" wrote in message
...
I am a newbie to macros and was wondering if someone could help me with

some
code to accomplish what I think is fairly simple to most of you. I'm

trying
to create a master list by piecing together information from various

sheets
off of an existing workbook.

What I would like to do is write a macro that would look at Sheet 1 and

copy
rows 7,9,10,11 then I need to skip 16 rows and copy rows 23,25,26,27 then
skip 16 rows and copy rows 39,41,42,43 etc. I've tried autofilter but it
doesn't work well with the structure of the existing worksheet.

Does anyone have any suggestions? Thanks in advance.

HJ



  #3   Report Post  
Posted to microsoft.public.excel.programming
HJ HJ is offline
external usenet poster
 
Posts: 28
Default Macro assistance needed

Hi Tom,

Thanks for the reply and please bear with me here...Can you tell me how to
modify the macro to copy from a tab called Input-Sales then to create a new
tab called Master where the copied data would go?
"Tom Ogilvy" wrote:

Dim i as long, rng as range
i = 7
do while not isempty(cells(i,1))
set rng = union(cells(i,1),cells(i+2).Resize(3))
rng.Entirerow.copy destination:= _
Worksheets(2).Cells(rows.count,1).End(xlup)
i = i + 16
Loop

--
Regards
Tom Ogilvy


"HJ" wrote in message
...
I am a newbie to macros and was wondering if someone could help me with

some
code to accomplish what I think is fairly simple to most of you. I'm

trying
to create a master list by piecing together information from various

sheets
off of an existing workbook.

What I would like to do is write a macro that would look at Sheet 1 and

copy
rows 7,9,10,11 then I need to skip 16 rows and copy rows 23,25,26,27 then
skip 16 rows and copy rows 39,41,42,43 etc. I've tried autofilter but it
doesn't work well with the structure of the existing worksheet.

Does anyone have any suggestions? Thanks in advance.

HJ




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro assistance needed

Sub CopyData()
Dim i As Long, rng As Range, sh As Worksheet
Worksheets.Add(After:=Worksheets( _
Worksheets.Count)).Name = "Master"
Set sh = Worksheets("Input-Sales")
i = 7
Do While Not IsEmpty(sh.Cells(i, 1))
Set rng = Union(sh.Cells(i, 1), _
sh.Cells(i + 2, 1).Resize(3, 1))
rng.EntireRow.Copy Destination:= _
Worksheets("Master").Cells(Rows.Count, 1).End(xlUp)
i = i + 16
Loop
End Sub



--
Regards,
Tom Ogilvy



"HJ" wrote in message
...
Hi Tom,

Thanks for the reply and please bear with me here...Can you tell me how to
modify the macro to copy from a tab called Input-Sales then to create a

new
tab called Master where the copied data would go?
"Tom Ogilvy" wrote:

Dim i as long, rng as range
i = 7
do while not isempty(cells(i,1))
set rng = union(cells(i,1),cells(i+2).Resize(3))
rng.Entirerow.copy destination:= _
Worksheets(2).Cells(rows.count,1).End(xlup)
i = i + 16
Loop

--
Regards
Tom Ogilvy


"HJ" wrote in message
...
I am a newbie to macros and was wondering if someone could help me

with
some
code to accomplish what I think is fairly simple to most of you. I'm

trying
to create a master list by piecing together information from various

sheets
off of an existing workbook.

What I would like to do is write a macro that would look at Sheet 1

and
copy
rows 7,9,10,11 then I need to skip 16 rows and copy rows 23,25,26,27

then
skip 16 rows and copy rows 39,41,42,43 etc. I've tried autofilter but

it
doesn't work well with the structure of the existing worksheet.

Does anyone have any suggestions? Thanks in advance.

HJ






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
Lookup assistance needed HowardM Excel Worksheet Functions 9 December 9th 09 05:13 PM
formula assistance needed Eric_in_EVV[_2_] Excel Worksheet Functions 2 October 27th 09 08:31 PM
Assistance needed with a formula Joyce Excel Worksheet Functions 1 October 15th 09 05:51 PM
CODE Assistance needed PLEASE please please N.F[_2_] Excel Discussion (Misc queries) 0 July 9th 07 08:36 PM
VBA Assistance Needed RalphB Excel Discussion (Misc queries) 5 February 22nd 06 06:16 PM


All times are GMT +1. The time now is 06:46 PM.

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

About Us

"It's about Microsoft Excel"