Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting all cells

Sub copyToTotal()
Dim sh as Worksheet
Dim x as Long
x = 100
for each sh in ActiveWorkbook.Worksheets
if lcase(sh.name) < "total" then
Range("2:" & x).Copy Destination:= _
worksheets("Total").Cells(rows.count,1).end(xlup)( 2)
end if
Next
End sub

--
Regards,
Tom Ogilvy


"Deus DNE" wrote in message
...
Hi,

I have a workbook with x number of sheets in it, each sheet contains x

rows.
The top row being the column titles. I need to write a macro/VB to select
all rows containing data except the title row, and paste them into a total
sheet.

What I really need is something more complex, but this will do for

starters
!

Hope you can help.

TIA

Deus
--
Does Not Exist




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selecting all cells

Hi,

I have a workbook with x number of sheets in it, each sheet contains x rows.
The top row being the column titles. I need to write a macro/VB to select
all rows containing data except the title row, and paste them into a total
sheet.

What I really need is something more complex, but this will do for starters
!

Hope you can help.

TIA

Deus
--
Does Not Exist


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting all cells

Left out the sh modifier

Sub copyToTotal()
Dim sh as Worksheet
Dim x as Long
x = 100
for each sh in ActiveWorkbook.Worksheets
if lcase(sh.name) < "total" then
' modify next line
sh.Range("2:" & x).Copy Destination:= _
worksheets("Total").Cells(rows.count,1).end(xlup)( 2)
end if
Next
End sub

--
Regards,
Tom Ogilvy

"Deus DNE" wrote in message
...
Thanks for that Tom.

However, running this appear to do nothing.

Which part s require modding to get the right result.

Sheets are

Total
5AW
5CF etc etc

Need all rows except title copying into row 2 downwards on Total sheet

Apologies for not having a clue :-)





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Selecting all cells

try this
Sub copytototal()
For Each ws In Sheets
x = ws.Cells(Rows.Count, "a").End(xlUp).Row
If UCase(ws.Name) < "TOTAL" Then
ws.Rows("1:" & x).Copy Sheets("total") _
..Rows(Cells(Rows.Count, "a").End(xlUp).Row + 1)
End If
Next ws
End Sub

--
Don Guillett
SalesAid Software

"Deus DNE" wrote in message
...
Hi,

I have a workbook with x number of sheets in it, each sheet contains x

rows.
The top row being the column titles. I need to write a macro/VB to select
all rows containing data except the title row, and paste them into a total
sheet.

What I really need is something more complex, but this will do for

starters
!

Hope you can help.

TIA

Deus
--
Does Not Exist




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Selecting all cells

Thanks for that Tom.

However, running this appear to do nothing.

Which part s require modding to get the right result.

Sheets are

Total
5AW
5CF etc etc

Need all rows except title copying into row 2 downwards on Total sheet

Apologies for not having a clue :-)





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting all cells

Since cells is unqualified, this will paste your values on top of each other
unless Total is the activesheet.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
try this
Sub copytototal()
For Each ws In Sheets
x = ws.Cells(Rows.Count, "a").End(xlUp).Row
If UCase(ws.Name) < "TOTAL" Then
ws.Rows("1:" & x).Copy Sheets("total") _
.Rows(Cells(Rows.Count, "a").End(xlUp).Row + 1)
End If
Next ws
End Sub

--
Don Guillett
SalesAid Software

"Deus DNE" wrote in message
...
Hi,

I have a workbook with x number of sheets in it, each sheet contains x

rows.
The top row being the column titles. I need to write a macro/VB to

select
all rows containing data except the title row, and paste them into a

total
sheet.

What I really need is something more complex, but this will do for

starters
!

Hope you can help.

TIA

Deus
--
Does Not Exist






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
Selecting multiple cells, I can't see the cells highlighted ET Excel Discussion (Misc queries) 1 August 1st 08 03:20 PM
How to change shade of cells when selecting multiple cells abrummet Excel Discussion (Misc queries) 3 September 6th 07 11:42 AM
By selecting cells adjacent to cells tally sheet tom Excel Worksheet Functions 2 September 20th 06 07:09 PM
selecting cells Chris Excel Discussion (Misc queries) 3 July 17th 06 09:58 PM
selecting cells ynissel Excel Discussion (Misc queries) 4 July 26th 05 08:06 PM


All times are GMT +1. The time now is 12:18 AM.

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"