ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Cut & Paste Need Special Macro (https://www.excelbanter.com/excel-discussion-misc-queries/200088-cut-paste-need-special-macro.html)

Miss Kitty[_2_]

Cut & Paste Need Special Macro
 
I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty

joel

Cut & Paste Need Special Macro
 
Destination need a := not an =

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination:=Sheets ("DO NOT CALL List").Range ("A2")
End With


"Miss Kitty" wrote:

I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty


Dave Peterson

Cut & Paste Need Special Macro
 
Maybe you could loop through D2:D15 looking for a match for that specific name.

Then copy to the "do not call list" worksheet:

dim DestCell as range
dim myCell as range
dim myRng as range
dim myStr as string

mystr = lcase("Some String to match here")

with worksheets("Canvassers"
set myrng = .range("d2:D15")
end with

for each mycell in myrng.cells
if lcase(mycell.value) = mystr then
with worksheets("do not call list")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with
mycell.entirerow.copy _
destination:=destcell
end if
next mycell

(Uncompiled, untested--watch for typos.)




Miss Kitty wrote:

I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty


--

Dave Peterson

Miss Kitty[_2_]

Cut & Paste Need Special Macro
 
Thank you I appreciate your prompt reply. But unfortunately it still doesn't
solve my problem for cutting/pasting specific information.
Any suggestions how I would do this?
--
Miss Kitty


"Joel" wrote:

Destination need a := not an =

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination:=Sheets ("DO NOT CALL List").Range ("A2")
End With


"Miss Kitty" wrote:

I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty


Miss Kitty[_2_]

Cut & Paste Need Special Macro
 
Sorry Dave can't seem to get it to work. I am not that great with Macros. But
thanks for your help I'll keep plugging along.
--
Miss Kitty


"Dave Peterson" wrote:

Maybe you could loop through D2:D15 looking for a match for that specific name.

Then copy to the "do not call list" worksheet:

dim DestCell as range
dim myCell as range
dim myRng as range
dim myStr as string

mystr = lcase("Some String to match here")

with worksheets("Canvassers"
set myrng = .range("d2:D15")
end with

for each mycell in myrng.cells
if lcase(mycell.value) = mystr then
with worksheets("do not call list")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with
mycell.entirerow.copy _
destination:=destcell
end if
next mycell

(Uncompiled, untested--watch for typos.)




Miss Kitty wrote:

I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty


--

Dave Peterson


Sheeloo

Cut & Paste Need Special Macro
 
Send the file to me at .

I will write the code and send to you within 24 hours.

"Miss Kitty" wrote:

Sorry Dave can't seem to get it to work. I am not that great with Macros. But
thanks for your help I'll keep plugging along.
--
Miss Kitty


"Dave Peterson" wrote:

Maybe you could loop through D2:D15 looking for a match for that specific name.

Then copy to the "do not call list" worksheet:

dim DestCell as range
dim myCell as range
dim myRng as range
dim myStr as string

mystr = lcase("Some String to match here")

with worksheets("Canvassers"
set myrng = .range("d2:D15")
end with

for each mycell in myrng.cells
if lcase(mycell.value) = mystr then
with worksheets("do not call list")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with
mycell.entirerow.copy _
destination:=destcell
end if
next mycell

(Uncompiled, untested--watch for typos.)




Miss Kitty wrote:

I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty


--

Dave Peterson


Miss Kitty[_2_]

Cut & Paste Need Special Macro
 
Thank you muchly! It is on its way.
--
Miss Kitty


"Sheeloo" wrote:

Send the file to me at .

I will write the code and send to you within 24 hours.

"Miss Kitty" wrote:

Sorry Dave can't seem to get it to work. I am not that great with Macros. But
thanks for your help I'll keep plugging along.
--
Miss Kitty


"Dave Peterson" wrote:

Maybe you could loop through D2:D15 looking for a match for that specific name.

Then copy to the "do not call list" worksheet:

dim DestCell as range
dim myCell as range
dim myRng as range
dim myStr as string

mystr = lcase("Some String to match here")

with worksheets("Canvassers"
set myrng = .range("d2:D15")
end with

for each mycell in myrng.cells
if lcase(mycell.value) = mystr then
with worksheets("do not call list")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with
mycell.entirerow.copy _
destination:=destcell
end if
next mycell

(Uncompiled, untested--watch for typos.)




Miss Kitty wrote:

I have been searching for days on how I can get a macro to copy/cut a row
from one spreadsheet and paste it into another automatically or even when I
run a Macro. The information will come from a validation list with specific
names. This is what I have so far;

With Sheets ("Canvassers")
.Range("D2:N15").Copy Destination: Sheets ("DO NOT CALL List").Range ("A2"
End With

My D column has the validation list in it and I have left my other sheet
completely blank except for a header.

This is working correctly but I seem to be missing something. I need it to
copy/cut ONLY the entire row that has only 1 specific validation name. This
copies/cuts the entire range no matter whats in the validation list.

I welcome anyone's expertise it will be much appreciated!
--
Miss Kitty

--

Dave Peterson



All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com