Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Copy down 1 column to the left

I have the following code that:

1. finds a cell Ex: B13
2. copies down from that cell Ex: B13:B15 (original data)
3. moves left one cell and pastes down Ex: A13:A15

The code I have then copies down from B13 to B15 and deletes the data in the
cell at the top (B13). This procedure is down several time in the document
and the ranges change each day. What I want it to do is copy down from
A13:A15, one column over from the original column of data. Anyone know how to
fix this??? Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Copy down 1 column to the left

Here is the code:

Range("A1").Select
Set c = Cells.find(What:="ASHELTON", LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)
Application.CutCopyMode = False



Set lastcell = c.End(xlDown)
Set DataRange = Range(c, lastcell)
DataRange.Copy _
Destination:=c.Offset(0, -1)
c.Copy Destination:=Range(c, lastcell)
c.ClearContents


firstAddress = c.Address
Do
Set c = Cells.find(What:="BAHOUST", _
After:=c, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)

Application.CutCopyMode = False


Set lastcell = c.End(xlDown)
Set DataRange = Range(c, lastcell)
DataRange.Copy _
Destination:=c.Offset(0, -1)
c.Copy Destination:=Range(c, lastcell)
c.ClearContents



End If



firstAddress = c.Address

Do
Set c = Cells.find(What:="CDMCNEAL", _
After:=c, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)
Application.CutCopyMode = False

End If

"Peruanos72" wrote:

I have the following code that:

1. finds a cell Ex: B13
2. copies down from that cell Ex: B13:B15 (original data)
3. moves left one cell and pastes down Ex: A13:A15

The code I have then copies down from B13 to B15 and deletes the data in the
cell at the top (B13). This procedure is down several time in the document
and the ranges change each day. What I want it to do is copy down from
A13:A15, one column over from the original column of data. Anyone know how to
fix this??? Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy down 1 column to the left

It may be easier to just send me your workbook to the address below along
with this msg copied into an inserted sheet and a clear explanation with
before/after examples. Looks like FINDNEXT in an array.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Peruanos72" wrote in message
...
Here is the code:

Range("A1").Select
Set c = Cells.find(What:="ASHELTON", LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)
Application.CutCopyMode = False



Set lastcell = c.End(xlDown)
Set DataRange = Range(c, lastcell)
DataRange.Copy _
Destination:=c.Offset(0, -1)
c.Copy Destination:=Range(c, lastcell)
c.ClearContents


firstAddress = c.Address
Do
Set c = Cells.find(What:="BAHOUST", _
After:=c, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)

Application.CutCopyMode = False


Set lastcell = c.End(xlDown)
Set DataRange = Range(c, lastcell)
DataRange.Copy _
Destination:=c.Offset(0, -1)
c.Copy Destination:=Range(c, lastcell)
c.ClearContents



End If



firstAddress = c.Address

Do
Set c = Cells.find(What:="CDMCNEAL", _
After:=c, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)
Application.CutCopyMode = False

End If

"Peruanos72" wrote:

I have the following code that:

1. finds a cell Ex: B13
2. copies down from that cell Ex: B13:B15 (original data)
3. moves left one cell and pastes down Ex: A13:A15

The code I have then copies down from B13 to B15 and deletes the data in
the
cell at the top (B13). This procedure is down several time in the
document
and the ranges change each day. What I want it to do is copy down from
A13:A15, one column over from the original column of data. Anyone know
how to
fix this??? Thanks in advance.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy down 1 column to the left

I sent this to fill in the employee name

Sub fillitin()
With Columns(2)
Set c = .Find(What:="Date", After:=.Cells(1, 2), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext)
If Not c Is Nothing Then
firstAddress = c.Address
Do
mc = Application.Count(Range(c.Offset(2), c.Offset(2).End(xlDown)))
c.Offset(3, -1).Resize(mc) = c.Offset(2)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
It may be easier to just send me your workbook to the address below along
with this msg copied into an inserted sheet and a clear explanation with
before/after examples. Looks like FINDNEXT in an array.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Peruanos72" wrote in message
...
Here is the code:

Range("A1").Select
Set c = Cells.find(What:="ASHELTON", LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)
Application.CutCopyMode = False



Set lastcell = c.End(xlDown)
Set DataRange = Range(c, lastcell)
DataRange.Copy _
Destination:=c.Offset(0, -1)
c.Copy Destination:=Range(c, lastcell)
c.ClearContents


firstAddress = c.Address
Do
Set c = Cells.find(What:="BAHOUST", _
After:=c, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)

Application.CutCopyMode = False


Set lastcell = c.End(xlDown)
Set DataRange = Range(c, lastcell)
DataRange.Copy _
Destination:=c.Offset(0, -1)
c.Copy Destination:=Range(c, lastcell)
c.ClearContents



End If



firstAddress = c.Address

Do
Set c = Cells.find(What:="CDMCNEAL", _
After:=c, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)


If Not c Is Nothing Then
Set DataRange = Range(c, c.End(xlDown))
DataRange.Copy _
Destination:=c.Offset(0, -1)
Application.CutCopyMode = False

End If

"Peruanos72" wrote:

I have the following code that:

1. finds a cell Ex: B13
2. copies down from that cell Ex: B13:B15 (original data)
3. moves left one cell and pastes down Ex: A13:A15

The code I have then copies down from B13 to B15 and deletes the data in
the
cell at the top (B13). This procedure is down several time in the
document
and the ranges change each day. What I want it to do is copy down from
A13:A15, one column over from the original column of data. Anyone know
how to
fix this??? Thanks in advance.



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
subtract column right from column left in excel? Muffin[_2_] New Users to Excel 2 June 17th 09 02:55 PM
how to copy down formulars into same column by a row left to righ Holly Excel Discussion (Misc queries) 5 April 3rd 07 10:59 PM
Column labels run right to left, not left to right tmassey Excel Discussion (Misc queries) 1 November 10th 06 11:03 AM
VB copy paste column data to another left to right sheet across sh baz Excel Programming 2 April 23rd 06 09:37 AM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM


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