LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default active offset

Ran up against a sort problem. Have code that will sort numerically but will
not move rows when it sorts on column. Not sure how to get rows into this
code. Useing column D for sort have a pull down in this column. This could be
changed to A if needed. Will paste the code that sorts. Hope having rows to
column M go with sort moveent. Any Ideas?
Thanks


Dim cell As Range
Dim rng As Range
Dim rng1 As Range
For Each cell In Range("D16")
Set rng = Range(cell, cell.End(xlDown))
cell.Offset(0, 1).EntireColumn.Insert
Set rng1 = cell.Offset(0, 1).Resize(rng.Count, 1)
rng1.Formula = "=Countif(" & rng(1).Address(1, 1) & _
":" & rng(1).Address(0, 0) & "," & _
rng(1).Address(0, 0) & ")"
rng1.Formula = rng1.Value
Range(cell, cell.Offset(0, 1)).Resize(rng.Count).Sort _
key1:=cell.Offset(0, 1), Order1:=xlAscending, _
key2:=cell, Order2:=xlAscending
cell.Offset(0, 1).EntireColumn.Delete
Next


"Don Guillett" wrote:

It is less confusing when you endeavor to learn to do it more efficiently
and properly. I suspect you are doing a LOT more than is necessary or
desirable.

--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
Learning is all ways confuseing.
Thanks for all your assistance


"Don Guillett" wrote:

As long as you are happy with doing it this way we will not try to
confuse
you further.

--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
To get from one sheet to the other must be in cell where data is to go
but
this is what worked for me. It can be copied for the whole column
Thanks to all
Option Explicit

Sub active_offset()
Dim data As Worksheet

Range("a2").Select
Selection.Cut
Sheets("Data").Select
ActiveSheet.Paste
End Sub

"Don Guillett" wrote:

Post your final solution for the benefit of all.

--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
Just to let you know. This old dog finnaly got it to work.
Thanks again for the support you and others give.
My Appreciation



"Don Guillett" wrote:

If you INSIST on doing it this way, you need to specify the cell.
There
is
no such thing as range("activecell")

Sub cutpaste()
Sheets("sheet10").Range("d16").Cut _
Destination:=Sheets("sheet9").Range("a1").offset( etc
End Sub


--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
when I try to copy it will not let me paste? Don't know why.This
is
code
for
copy not right.
Sub active_offset()
Range("a2").Select
Selection.Cut
------------------------trouble from here
Sheets("data").Select
Range("active cell").Select
ActiveCell.Offset(0, -1).Value = "desc,a2"
ActiveSheet.Paste
I am in wksheet desc want to cut then paste to active cell offset
wksheet
data active cell
Thanks for your effort I greatly appreciate it


"Don Guillett" wrote:

Send your workbook, with code and details of what you want and I
will
have a
look.

--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
Hope you get this one first. Got away from screen and helped
with
reply.
Ihave a macro in column 'N?' in data wksheet. This macro calls
a
procedure
that formats and sets up desc wksheet cell A2. text is then
entered.
Now
need
to be able to cut & paste 'A2' to Active cell 'N?' offset to
column
'Mcell?'
Useing an active cell ref all I have to do for each cell is
call
procedure.
Thanks for Your Patiance.



"Don Guillett" wrote:

You can probably have a much simpler looping macro. Why not
give
us
much
more info.

--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
I am trying to use the active cell offset so as not to have
to
have a
procedure for each cell. This operation must be done
repeated
times.
Trying
to figure how to write one procedure that can reference
where
called
from
so
as to call it the active cell to offset from. This way all
I
need
to
do
is
call this procedure from the cells in repeated moves.May be
up
to
150
times
to enter data to use this method. If I can keep from having
to
use
addresses
in each call that is what I am after I think. It is hard to
explain
and
for
another to grasp.
I will toy with what you sent and see what I can do
Thanks



"Don Guillett" wrote:

It's not clear to me what you are trying to do but this
will
MOVE a
cell
to
another worksheet withOUT any selections of any kind. This
is
a
ONE
liner
that I split using the continuation _ to prevent word
wrap.

Sub cutpaste()
Sheets("sheet10").Range("d16").Cut _
Destination:=Sheets("sheet9").Range("G1")
End Sub

without the split
Sheets("sheet10").Range("d16").Cut
Destination:=Sheets("sheet9").Range("G1")

--
Don Guillett
SalesAid Software

"Curt" wrote in message
...
never used this. Am trying to call sub desc_1 with a
macro
in
m16
of"
data".
This takes me to a diff wksheet "desc". I then input
data.
Want
ot
cut
and
paste the cell back to L16 of"data" i called from. This
would
be
offset
1.
following is the subs I am trying to work with. Can I
declare
m16
of
sheet
the active cell?
Old Dog New Tricks
Thanks


Sub Desc_1()
'
' Desc_1 Macro
' Macro recorded 1/11/2007 by Default
'
Range("N16").Select
Sheets("Desc").Select
Range("A2").Select
Rows("2:2").RowHeight = 78
Columns("A:A").ColumnWidth = 39
Selection.NumberFormat = "@"
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Locked = True
Selection.FormulaHidden = False
End Sub
Sub Desc_1A()
'
' Desc_2 Macro
' Macro recorded 1/11/2007 by Default
'
Range("A2").Select
Selection.Cut
Sheets("Data").Select
Range("M16").Select
ActiveSheet.Paste
Selection.NumberFormat = "@"
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = True
.MergeCells = False
End With
Selection.Locked = True
Selection.FormulaHidden = False
End Sub


















 
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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
move from active cell offset in macro april Excel Discussion (Misc queries) 5 October 18th 09 05:02 PM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Find, Copy offset to offset on other sheet, Run-time 1004. Finny[_3_] Excel Programming 10 December 7th 06 11:46 PM
HOW TO COPY 480 ACTIVE E-MAIL ADDRESSES CLM "G" ON AN ACTIVE EXCE. ragman10 Excel Discussion (Misc queries) 1 December 13th 04 11:52 PM


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