Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Copying Visible Cells

In Range C8:E31 I have random integers.

How do I copy JUST the VISIBLE CELLS to Range AE8:AG31 and
sort them in ascending order.

Column C data, copies to Column AE
Column D data, copies to Column AF
Column E data, copies to Column AG

Could anyone help here please.

Thankyou.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Copying Visible Cells

This should work. On filtered data when you copy you copy all you copy the
visible only. Of course, with the ranges you are using you won't see until
you unfilter.

Sub copysort()
Range("ae2").Copy Range("ae8")
Range("ae8:ag31").Sort Key1:=Range("ae8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Don Guillett
SalesAid Software

" wrote in
message ...
In Range C8:E31 I have random integers.

How do I copy JUST the VISIBLE CELLS to Range AE8:AG31 and
sort them in ascending order.

Column C data, copies to Column AE
Column D data, copies to Column AF
Column E data, copies to Column AG

Could anyone help here please.

Thankyou.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Copying Visible Cells

Hi Don,

Thanks for your reply. I don't understand!!!
How did AE2 get into the picture. Do you mean C8:E31.
Either way, the macro just copies any formulas and
formatting from C8:E31 to AE8. Nothing visible.

C8:E31 contains formulas in each cell which produce
numbers (integers) in the range. They can appear in any of
the cells in any sequence, so I can have C8 with 2, C11
with 4, C20 with 6 etc. I want to grab only these numbers
i.e 2,4 and 6 and copy then to AE8 in order. I can't have
2 blank blank 4 etc, because when I then use this data in
another macro, it crashes out because of the blank cells.
(which obviously have data in them as a result of being
copied from a cell with a formula.)

Everything works fine if I just manually type in the 2,4,6
in AE8 down but using a macro to do it fails.

Must be missing something here. Any other thoughts?

Kind regards,
Richard



-----Original Message-----
This should work. On filtered data when you copy you copy

all you copy the
visible only. Of course, with the ranges you are using

you won't see until
you unfilter.

Sub copysort()
Range("ae2").Copy Range("ae8")
Range("ae8:ag31").Sort Key1:=Range("ae8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Don Guillett
SalesAid Software

"

wrote in
message ...
In Range C8:E31 I have random integers.

How do I copy JUST the VISIBLE CELLS to Range AE8:AG31

and
sort them in ascending order.

Column C data, copies to Column AE
Column D data, copies to Column AF
Column E data, copies to Column AG

Could anyone help here please.

Thankyou.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying Visible Cells

Sub copysort()
Dim cell As Range, rng As Range
Dim rw As Long
rw = 8
For Each cell In Range("C8:C31")
If Len(Trim(cell.Text)) < 0 Then
Cells(rw, "AE").Resize(1, 3).Value = _
cell.Resize(1, 3).Value
rw = rw + 1
End If
Next
If IsEmpty(Range("AE8")) Then
MsgBox "Nothing found"
Exit Sub
End If
Range("AE8:AG31").Sort Key1:=Range("AE8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Regards,
Tom Ogilvy


wrote in message
...
Hi Don,

Thanks for your reply. I don't understand!!!
How did AE2 get into the picture. Do you mean C8:E31.
Either way, the macro just copies any formulas and
formatting from C8:E31 to AE8. Nothing visible.

C8:E31 contains formulas in each cell which produce
numbers (integers) in the range. They can appear in any of
the cells in any sequence, so I can have C8 with 2, C11
with 4, C20 with 6 etc. I want to grab only these numbers
i.e 2,4 and 6 and copy then to AE8 in order. I can't have
2 blank blank 4 etc, because when I then use this data in
another macro, it crashes out because of the blank cells.
(which obviously have data in them as a result of being
copied from a cell with a formula.)

Everything works fine if I just manually type in the 2,4,6
in AE8 down but using a macro to do it fails.

Must be missing something here. Any other thoughts?

Kind regards,
Richard



-----Original Message-----
This should work. On filtered data when you copy you copy

all you copy the
visible only. Of course, with the ranges you are using

you won't see until
you unfilter.

Sub copysort()
Range("ae2").Copy Range("ae8")
Range("ae8:ag31").Sort Key1:=Range("ae8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Don Guillett
SalesAid Software

"

wrote in
message ...
In Range C8:E31 I have random integers.

How do I copy JUST the VISIBLE CELLS to Range AE8:AG31

and
sort them in ascending order.

Column C data, copies to Column AE
Column D data, copies to Column AF
Column E data, copies to Column AG

Could anyone help here please.

Thankyou.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Copying Visible Cells

Thanks Tom,
Regards,
Richard

-----Original Message-----
Sub copysort()
Dim cell As Range, rng As Range
Dim rw As Long
rw = 8
For Each cell In Range("C8:C31")
If Len(Trim(cell.Text)) < 0 Then
Cells(rw, "AE").Resize(1, 3).Value = _
cell.Resize(1, 3).Value
rw = rw + 1
End If
Next
If IsEmpty(Range("AE8")) Then
MsgBox "Nothing found"
Exit Sub
End If
Range("AE8:AG31").Sort Key1:=Range("AE8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Regards,
Tom Ogilvy



wrote in message
...
Hi Don,

Thanks for your reply. I don't understand!!!
How did AE2 get into the picture. Do you mean C8:E31.
Either way, the macro just copies any formulas and
formatting from C8:E31 to AE8. Nothing visible.

C8:E31 contains formulas in each cell which produce
numbers (integers) in the range. They can appear in any

of
the cells in any sequence, so I can have C8 with 2, C11
with 4, C20 with 6 etc. I want to grab only these

numbers
i.e 2,4 and 6 and copy then to AE8 in order. I can't

have
2 blank blank 4 etc, because when I then use this data

in
another macro, it crashes out because of the blank

cells.
(which obviously have data in them as a result of being
copied from a cell with a formula.)

Everything works fine if I just manually type in the

2,4,6
in AE8 down but using a macro to do it fails.

Must be missing something here. Any other thoughts?

Kind regards,
Richard



-----Original Message-----
This should work. On filtered data when you copy you

copy
all you copy the
visible only. Of course, with the ranges you are using

you won't see until
you unfilter.

Sub copysort()
Range("ae2").Copy Range("ae8")
Range("ae8:ag31").Sort Key1:=Range("ae8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Don Guillett
SalesAid Software

"

wrote in
message ...
In Range C8:E31 I have random integers.

How do I copy JUST the VISIBLE CELLS to Range

AE8:AG31
and
sort them in ascending order.

Column C data, copies to Column AE
Column D data, copies to Column AF
Column E data, copies to Column AG

Could anyone help here please.

Thankyou.



.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Copying Visible Cells

Sorry, I had a typo
Range("ae2").Copy Range("ae8")

Range("c8:e31").Copy Range("ae8")
but I guess I also didn't understand the question. I assumed that visible
cells were cells that had been hidden or filtered as that is what you
indicated.
I see that Tom got clarification and provided your answer.

--
Don Guillett
SalesAid Software

" wrote in
message ...
Hi Don,

Thanks for your reply. I don't understand!!!
How did AE2 get into the picture. Do you mean C8:E31.
Either way, the macro just copies any formulas and
formatting from C8:E31 to AE8. Nothing visible.

C8:E31 contains formulas in each cell which produce
numbers (integers) in the range. They can appear in any of
the cells in any sequence, so I can have C8 with 2, C11
with 4, C20 with 6 etc. I want to grab only these numbers
i.e 2,4 and 6 and copy then to AE8 in order. I can't have
2 blank blank 4 etc, because when I then use this data in
another macro, it crashes out because of the blank cells.
(which obviously have data in them as a result of being
copied from a cell with a formula.)

Everything works fine if I just manually type in the 2,4,6
in AE8 down but using a macro to do it fails.

Must be missing something here. Any other thoughts?

Kind regards,
Richard



-----Original Message-----
This should work. On filtered data when you copy you copy

all you copy the
visible only. Of course, with the ranges you are using

you won't see until
you unfilter.

Sub copysort()
Range("ae2").Copy Range("ae8")
Range("ae8:ag31").Sort Key1:=Range("ae8"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub

--
Don Guillett
SalesAid Software

"

wrote in
message ...
In Range C8:E31 I have random integers.

How do I copy JUST the VISIBLE CELLS to Range AE8:AG31

and
sort them in ascending order.

Column C data, copies to Column AE
Column D data, copies to Column AF
Column E data, copies to Column AG

Could anyone help here please.

Thankyou.



.



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 visible merged cells rtwiss Excel Discussion (Misc queries) 2 October 1st 08 08:15 PM
Copying and pasting to visible cells only FJ Excel Discussion (Misc queries) 4 November 17th 06 01:01 AM
problem copying visible cells from 2000 to 2003 rtillt Excel Discussion (Misc queries) 2 August 18th 06 05:34 PM
Copying visible cells only on a protected worksheet Paula Excel Discussion (Misc queries) 0 June 6th 06 05:32 PM
Help: Copying Visible Cells only to Visible cells! Jay Jayakumar Excel Programming 0 July 9th 03 08:25 PM


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