Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 2 questions: copying between sheets and display 0 data...

First off, Hello!

I am new to the group so please bear with my stupidity...

I have an Excel SS like this:

Brand Store Number Shipped/Receive Date Item 1 Item 2 Item 3
Alpha 5017 3/19/2007 X
Beta 5027 3/19/2007 X

Etc, etc. there are about 50 rows across.

I'd like to copy the 1st 3 columns to another sheet (which I can do
with a macro, I'd just like to do it as part of a formula)

Then I would like to do some form of if/then statement to copy only
the cells and headers that have data in them to the same new sheet.

For instance, in the above example, I don't want the blank fields to
show.

Any ideas?

If I am being unclear (God knows I hardly understood it and I wrote
it), please let me know.

Thanks in advance!

Grim

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default 2 questions: copying between sheets and display 0 data...

Grim: formulas won't copy cells, only a macro subroutine will do that. You
can reference different worksheets in a formula such as

On sheet2 cell A1
='sheet1'!B7


Refercing cells cannot remove empty rows.
The best way is with a macro subroutine.
"Grim" wrote:

First off, Hello!

I am new to the group so please bear with my stupidity...

I have an Excel SS like this:

Brand Store Number Shipped/Receive Date Item 1 Item 2 Item 3
Alpha 5017 3/19/2007 X
Beta 5027 3/19/2007 X

Etc, etc. there are about 50 rows across.

I'd like to copy the 1st 3 columns to another sheet (which I can do
with a macro, I'd just like to do it as part of a formula)

Then I would like to do some form of if/then statement to copy only
the cells and headers that have data in them to the same new sheet.

For instance, in the above example, I don't want the blank fields to
show.

Any ideas?

If I am being unclear (God knows I hardly understood it and I wrote
it), please let me know.

Thanks in advance!

Grim


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 2 questions: copying between sheets and display 0 data...

Joel,

Thanks for the response.

I got the macro to copy from 1 sheet to another down, is there a macro
that will search a row and paste only headers w/data in them to
another sheet?

I tried doing this in acces... but it just laughed at me.

Thanks again.

Grim

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default 2 questions: copying between sheets and display 0 data...

you need to do something like this

Sub copycolumns()

Sheets("sheet1").Activate
Lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Set HeaderRange = Range(Cells(1, 1), Cells(1, Lastcol))

ColumnCount = 1
For Each cell In HeaderRange

If Not IsEmpty(cell) Then

cell.EntireColumn.Copy _
Destination:=Sheets("sheet2").Columns(ColumnCount)


ColumnCount = ColumnCount + 1
End If

Next cell

End Sub

"Grim" wrote:

Joel,

Thanks for the response.

I got the macro to copy from 1 sheet to another down, is there a macro
that will search a row and paste only headers w/data in them to
another sheet?

I tried doing this in acces... but it just laughed at me.

Thanks again.

Grim


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default 2 questions: copying between sheets and display 0 data...

This will work

Sub copycolumns()

Sheets("sheet1").Activate
Lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
Set HeaderRange = Range(Cells(1, 1), Cells(1, Lastcol))

ColumnCount = 1
For Each cell In HeaderRange

If Not IsEmpty(cell) Then

cell.EntireColumn.Copy _
Destination:=Sheets("sheet2").Columns(ColumnCount)


ColumnCount = ColumnCount + 1
End If

Next cell

End Sub


"Grim" wrote:

Joel,

Thanks for the response.

I got the macro to copy from 1 sheet to another down, is there a macro
that will search a row and paste only headers w/data in them to
another sheet?

I tried doing this in acces... but it just laughed at me.

Thanks again.

Grim




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default macros excel

excel macros

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
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
copying data in multiple sheets KT Excel Worksheet Functions 1 November 8th 06 10:28 PM
Trnasferring/ Copying Data Between Sheets Neil M Excel Worksheet Functions 1 May 12th 06 09:21 AM
Automating data copying between work sheets Ian1 New Users to Excel 6 February 17th 06 03:41 PM
In 3 active sheets in wkbk, determine& display the # of sheets that have data wrpalmer Excel Discussion (Misc queries) 1 November 4th 05 03:01 PM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 07:11 PM


All times are GMT +1. The time now is 06:32 AM.

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"