#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default loop?

can you help me
i'm trying to create a macro that will loop through all the data in a user
specified column/row and return on a new sheet all non-blank data from that
selected colum or row with the relevant row/column headers as appear on
original sheet.

I'm a bit new to this sorry!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default loop?

With Worksheets("Sheet2")

Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "A").Value = "" Then

.Rows(i).Delete
End If
Next i
End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message
...
can you help me
i'm trying to create a macro that will loop through all the data in a user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.

I'm a bit new to this sorry!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default loop?

typo.......

Worksheets("Sheet1")Column(1).Copy .Range("A1")
should be
Worksheets("Sheet1").Column(1).Copy.Range("A1")

:)
susan


On Jun 24, 3:02*pm, "Bob Phillips" wrote:
* * With Worksheets("Sheet2")

* * * * Worksheets("Sheet1")Column(1).Copy .Range("A1")
* * * * LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
* * * * For i = LastRow To 2 Step -1

* * * * * * If .Cells(i, "A").Value = "" Then

* * * * * * * * .Rows(i).Delete
* * * * * * End If
* * * * Next i
* * End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message

...



can you help me
i'm trying to create a macro that will loop through all the data in a user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.


I'm a bit new to this sorry!- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default loop?

You missed the other one

Worksheets("Sheet1").Columns(1).Copy.Range("A1")


--
__________________________________
HTH

Bob

"Susan" wrote in message
...
typo.......

Worksheets("Sheet1")Column(1).Copy .Range("A1")
should be
Worksheets("Sheet1").Column(1).Copy.Range("A1")

:)
susan


On Jun 24, 3:02 pm, "Bob Phillips" wrote:
With Worksheets("Sheet2")

Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "A").Value = "" Then

.Rows(i).Delete
End If
Next i
End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message

...



can you help me
i'm trying to create a macro that will loop through all the data in a
user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.


I'm a bit new to this sorry!- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default loop?

yep, i got the & the space, but missed the s on the columns.......
LOL
susan


On Jun 24, 3:25*pm, "Bob Phillips" wrote:
You missed the other one

Worksheets("Sheet1").Columns(1).Copy.Range("A1")

--
__________________________________
HTH

Bob

"Susan" wrote in message

...
typo.......

Worksheets("Sheet1")Column(1).Copy .Range("A1")
should be
Worksheets("Sheet1").Column(1).Copy.Range("A1")

:)
susan

On Jun 24, 3:02 pm, "Bob Phillips" wrote:



With Worksheets("Sheet2")


Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1


If .Cells(i, "A").Value = "" Then


.Rows(i).Delete
End If
Next i
End With


--
__________________________________
HTH


Bob


"scaredycat" wrote in message


...


can you help me
i'm trying to create a macro that will loop through all the data in a
user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.


I'm a bit new to this sorry!- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default loop?

Thanks guys for all your help, but I still can't get it to work, what object
do I need to define....i'm sorry to bother you further but thank you so much
for your help so far

Thanks :)

"Susan" wrote:

yep, i got the & the space, but missed the s on the columns.......
LOL
susan


On Jun 24, 3:25 pm, "Bob Phillips" wrote:
You missed the other one

Worksheets("Sheet1").Columns(1).Copy.Range("A1")

--
__________________________________
HTH

Bob

"Susan" wrote in message

...
typo.......

Worksheets("Sheet1")Column(1).Copy .Range("A1")
should be
Worksheets("Sheet1").Column(1).Copy.Range("A1")

:)
susan

On Jun 24, 3:02 pm, "Bob Phillips" wrote:



With Worksheets("Sheet2")


Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1


If .Cells(i, "A").Value = "" Then


.Rows(i).Delete
End If
Next i
End With


--
__________________________________
HTH


Bob


"scaredycat" wrote in message


...


can you help me
i'm trying to create a macro that will loop through all the data in a
user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.


I'm a bit new to this sorry!- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default loop?

Sorry guys... it still doesn't like that line i've now got a message saying
"runtime error 424 object required" what does that mean?

"Bob Phillips" wrote:

You missed the other one

Worksheets("Sheet1").Columns(1).Copy.Range("A1")


--
__________________________________
HTH

Bob

"Susan" wrote in message
...
typo.......

Worksheets("Sheet1")Column(1).Copy .Range("A1")
should be
Worksheets("Sheet1").Column(1).Copy.Range("A1")

:)
susan


On Jun 24, 3:02 pm, "Bob Phillips" wrote:
With Worksheets("Sheet2")

Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "A").Value = "" Then

.Rows(i).Delete
End If
Next i
End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message

...



can you help me
i'm trying to create a macro that will loop through all the data in a
user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.


I'm a bit new to this sorry!- Hide quoted text -


- Show quoted text -




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default loop?

Worksheets("Sheet1").Columns(1).Copy _
destination:=.Range("A1")

Or

Worksheets("Sheet1").Columns(1).Copy .Range("A1") '<--note the spaces!

scaredycat wrote:

Sorry guys... it still doesn't like that line i've now got a message saying
"runtime error 424 object required" what does that mean?

"Bob Phillips" wrote:

You missed the other one

Worksheets("Sheet1").Columns(1).Copy.Range("A1")


--
__________________________________
HTH

Bob

"Susan" wrote in message
...
typo.......

Worksheets("Sheet1")Column(1).Copy .Range("A1")
should be
Worksheets("Sheet1").Column(1).Copy.Range("A1")

:)
susan


On Jun 24, 3:02 pm, "Bob Phillips" wrote:
With Worksheets("Sheet2")

Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "A").Value = "" Then

.Rows(i).Delete
End If
Next i
End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message

...



can you help me
i'm trying to create a macro that will loop through all the data in a
user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.

I'm a bit new to this sorry!- Hide quoted text -

- Show quoted text -





--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default loop?

Thanks Bob but excel has a prblem with this it has a message that says "sub
or function not defined" for the word 'Column' in this line

Worksheets("Sheet1")Column(1).Copy .Range("A1")

I'm probably being really basic but how do I fix this?

many thanks



"Bob Phillips" wrote:

With Worksheets("Sheet2")

Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "A").Value = "" Then

.Rows(i).Delete
End If
Next i
End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message
...
can you help me
i'm trying to create a macro that will loop through all the data in a user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.

I'm a bit new to this sorry!




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default loop?

Typo on my part, try

Worksheets("Sheet1").Columns(1).Copy .Range("A1")

--
__________________________________
HTH

Bob

"scaredycat" wrote in message
...
Thanks Bob but excel has a prblem with this it has a message that says
"sub
or function not defined" for the word 'Column' in this line

Worksheets("Sheet1")Column(1).Copy .Range("A1")

I'm probably being really basic but how do I fix this?

many thanks



"Bob Phillips" wrote:

With Worksheets("Sheet2")

Worksheets("Sheet1")Column(1).Copy .Range("A1")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow To 2 Step -1

If .Cells(i, "A").Value = "" Then

.Rows(i).Delete
End If
Next i
End With

--
__________________________________
HTH

Bob

"scaredycat" wrote in message
...
can you help me
i'm trying to create a macro that will loop through all the data in a
user
specified column/row and return on a new sheet all non-blank data from
that
selected colum or row with the relevant row/column headers as appear on
original sheet.

I'm a bit new to this sorry!








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
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 02:28 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"