Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default correction needed

I been sent macro by one of online friend . This macro copies entire
row from sheet1 to sheet2. what should i do that this macro only copy
rows from cell A to cell F instead of coping entire row. please any
body can give any suggestions or macro

Sub movedata()

OldShRowCount = 1
NewShRowCount = 2

With Sheets("Sheet1")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = .Range("D" & (OldShRowCount + 1)))
And (.Range("E" & OldShRowCount) < .Range("E" & (OldShRowCount + 1)))
Then
..Rows(OldShRowCount).Copy
Destination:=Sheets("Sheet2").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With


End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default correction needed

Start over and tell us exactly what you want to do with before/after
examples. It probably can be that you copy all at once instead of one at a
time.
but to answer your question about copy range

.Rows(OldShRowCount).Copy

to
..range(cells(OldShRowCount,"a"),cells(OldShRowCou nt,"f")).Copy _
Sheets("Sheet2").range(NewShRowCount,"a")


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"K" wrote in message
...
I been sent macro by one of online friend . This macro copies entire
row from sheet1 to sheet2. what should i do that this macro only copy
rows from cell A to cell F instead of coping entire row. please any
body can give any suggestions or macro

Sub movedata()

OldShRowCount = 1
NewShRowCount = 2

With Sheets("Sheet1")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = .Range("D" & (OldShRowCount + 1)))
And (.Range("E" & OldShRowCount) < .Range("E" & (OldShRowCount + 1)))
Then
.Rows(OldShRowCount).Copy
Destination:=Sheets("Sheet2").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With


End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default correction needed

On Dec 16, 5:50 pm, "Don Guillett" wrote:
Start over and tell us exactly what you want to do with before/after
examples. It probably can be that you copy all at once instead of one at a
time.
but to answer your question about copy range

.Rows(OldShRowCount).Copy


to
.range(cells(OldShRowCount,"a"),cells(OldShRowCoun t,"f")).Copy _
Sheets("Sheet2").range(NewShRowCount,"a")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"K" wrote in message

...



I been sent macro by one of online friend . This macro copies entire
row from sheet1 to sheet2. what should i do that this macro only copy
rows from cell A to cell F instead of coping entire row. please any
body can give any suggestions or macro


Sub movedata()


OldShRowCount = 1
NewShRowCount = 2


With Sheets("Sheet1")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = .Range("D" & (OldShRowCount + 1)))
And (.Range("E" & OldShRowCount) < .Range("E" & (OldShRowCount + 1)))
Then
.Rows(OldShRowCount).Copy
Destination:=Sheets("Sheet2").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With


End Sub- Hide quoted text -


- Show quoted text -


Thanks Don this really works

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default correction needed

Most of us TOP post here. I guess that your statement means that my
suggestion helped and that you don't want to know a better way?

Thanks Don this really works


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"K" wrote in message
...
On Dec 16, 5:50 pm, "Don Guillett" wrote:
Start over and tell us exactly what you want to do with before/after
examples. It probably can be that you copy all at once instead of one at
a
time.
but to answer your question about copy range

.Rows(OldShRowCount).Copy


to
.range(cells(OldShRowCount,"a"),cells(OldShRowCoun t,"f")).Copy _
Sheets("Sheet2").range(NewShRowCount,"a")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"K" wrote in message

...



I been sent macro by one of online friend . This macro copies entire
row from sheet1 to sheet2. what should i do that this macro only copy
rows from cell A to cell F instead of coping entire row. please any
body can give any suggestions or macro


Sub movedata()


OldShRowCount = 1
NewShRowCount = 2


With Sheets("Sheet1")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = .Range("D" & (OldShRowCount + 1)))
And (.Range("E" & OldShRowCount) < .Range("E" & (OldShRowCount + 1)))
Then
.Rows(OldShRowCount).Copy
Destination:=Sheets("Sheet2").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With


End Sub- Hide quoted text -


- Show quoted text -


Thanks Don this really works


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default correction needed

Don, I think K has a secret project going on. The OP does not give very much
info about what they are trying to do, just what they want the macro to do,
one piece at the time.

"Don Guillett" wrote:

Most of us TOP post here. I guess that your statement means that my
suggestion helped and that you don't want to know a better way?

Thanks Don this really works


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"K" wrote in message
...
On Dec 16, 5:50 pm, "Don Guillett" wrote:
Start over and tell us exactly what you want to do with before/after
examples. It probably can be that you copy all at once instead of one at
a
time.
but to answer your question about copy range

.Rows(OldShRowCount).Copy

to
.range(cells(OldShRowCount,"a"),cells(OldShRowCoun t,"f")).Copy _
Sheets("Sheet2").range(NewShRowCount,"a")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"K" wrote in message

...



I been sent macro by one of online friend . This macro copies entire
row from sheet1 to sheet2. what should i do that this macro only copy
rows from cell A to cell F instead of coping entire row. please any
body can give any suggestions or macro

Sub movedata()

OldShRowCount = 1
NewShRowCount = 2

With Sheets("Sheet1")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = .Range("D" & (OldShRowCount + 1)))
And (.Range("E" & OldShRowCount) < .Range("E" & (OldShRowCount + 1)))
Then
.Rows(OldShRowCount).Copy
Destination:=Sheets("Sheet2").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With

End Sub- Hide quoted text -

- Show quoted text -


Thanks Don this really works





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default correction needed


Then we need a "secret decoder ring"
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JLGWhiz" wrote in message
...
Don, I think K has a secret project going on. The OP does not give very
much
info about what they are trying to do, just what they want the macro to
do,
one piece at the time.

"Don Guillett" wrote:

Most of us TOP post here. I guess that your statement means that my
suggestion helped and that you don't want to know a better way?

Thanks Don this really works


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"K" wrote in message
...
On Dec 16, 5:50 pm, "Don Guillett" wrote:
Start over and tell us exactly what you want to do with before/after
examples. It probably can be that you copy all at once instead of one
at
a
time.
but to answer your question about copy range

.Rows(OldShRowCount).Copy

to
.range(cells(OldShRowCount,"a"),cells(OldShRowCoun t,"f")).Copy _
Sheets("Sheet2").range(NewShRowCount,"a")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"K" wrote in message

...



I been sent macro by one of online friend . This macro copies entire
row from sheet1 to sheet2. what should i do that this macro only
copy
rows from cell A to cell F instead of coping entire row. please any
body can give any suggestions or macro

Sub movedata()

OldShRowCount = 1
NewShRowCount = 2

With Sheets("Sheet1")
Do While .Range("D" & OldShRowCount) < ""
If (.Range("D" & OldShRowCount) = .Range("D" & (OldShRowCount + 1)))
And (.Range("E" & OldShRowCount) < .Range("E" & (OldShRowCount +
1)))
Then
.Rows(OldShRowCount).Copy
Destination:=Sheets("Sheet2").Rows(NewShRowCount)
NewShRowCount = NewShRowCount + 1
End If
OldShRowCount = OldShRowCount + 1
Loop
End With

End Sub- Hide quoted text -

- Show quoted text -

Thanks Don this really works




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
Value correction P. Zicari Excel Discussion (Misc queries) 2 April 15th 08 07:28 PM
Code correction pls help Ram[_5_] Excel Programming 5 August 16th 07 03:47 PM
VBA Code Correction RichIT Excel Programming 3 August 10th 06 05:02 PM
correction nowfal Excel Discussion (Misc queries) 4 March 24th 06 06:40 PM
two arrays correction Jerry Kinder New Users to Excel 2 February 25th 06 10:00 PM


All times are GMT +1. The time now is 12:16 AM.

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"