Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Copy/Paste Values

I am entering parameters in worksheet 1 (i.e. Jones) and corresponding data
in worksheet 2 is based, through vlookup commands on these parameters. I
would like to enter code (preferably at the click of a button on worksheet 1)
to go to worksheet 2, look down Column A for the number 1 (there will only be
one) and copy paste values that data on that row only and then return back to
worksheet 1. This automation would certainly speed up this lengthy process.
Any thoughts?

Worksheet 2
0 Smith 9.98 5.67 4.35
1 Jones 6.57 3.21 8.65
0 Ranz 2.98 7.57 2.22

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy/Paste Values

Why not use vlookup commands on sheet1 as well?

--
Regards,
Tom Ogilvy

"briank" wrote in message
...
I am entering parameters in worksheet 1 (i.e. Jones) and corresponding

data
in worksheet 2 is based, through vlookup commands on these parameters. I
would like to enter code (preferably at the click of a button on worksheet

1)
to go to worksheet 2, look down Column A for the number 1 (there will only

be
one) and copy paste values that data on that row only and then return back

to
worksheet 1. This automation would certainly speed up this lengthy

process.
Any thoughts?

Worksheet 2
0 Smith 9.98 5.67 4.35
1 Jones 6.57 3.21 8.65
0 Ranz 2.98 7.57 2.22



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Copy/Paste Values

The way that sheet 1 was set up by another manager involves pivot tables and
only one choice or parameter can be entered at a time. I'm sure a better
setup was possible but at the moment I have to deal with someone else's
development. Is this possible to construct the code to allow for this
automation?

"Tom Ogilvy" wrote:

Why not use vlookup commands on sheet1 as well?

--
Regards,
Tom Ogilvy

"briank" wrote in message
...
I am entering parameters in worksheet 1 (i.e. Jones) and corresponding

data
in worksheet 2 is based, through vlookup commands on these parameters. I
would like to enter code (preferably at the click of a button on worksheet

1)
to go to worksheet 2, look down Column A for the number 1 (there will only

be
one) and copy paste values that data on that row only and then return back

to
worksheet 1. This automation would certainly speed up this lengthy

process.
Any thoughts?

Worksheet 2
0 Smith 9.98 5.67 4.35
1 Jones 6.57 3.21 8.65
0 Ranz 2.98 7.57 2.22




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy/Paste Values

You say there will only be one occurance of the number and start right out
with an example that has duplicate numbers.

Assume you enter a number in A1 of sheet1

Private Sub Commandbutton1_Click()
Dim sh1 as Worksheet
Dim sh2 as Worksheet
Dim rng as Range, rng1 as Range
Dim res as Variant
Set sh1 = Worksheets(1)
Set sh2 = Worksheets(2)
set rng = sh2.Range(sh2.Cells(1,1), sh2.Cells(rows.count,1).end(xlup))
res = Application.Match(sh1.Range("A1"),rng,0)
if iserror(res) then
msgbox "Not found"
else
set rng1 = rng(res)
rng1.resize(1,20).copy Destination:=sh1.Range("B1")
end if
End Sub
--
Regards,
Tom Ogilvy

"briank" wrote in message
...
The way that sheet 1 was set up by another manager involves pivot tables

and
only one choice or parameter can be entered at a time. I'm sure a better
setup was possible but at the moment I have to deal with someone else's
development. Is this possible to construct the code to allow for this
automation?

"Tom Ogilvy" wrote:

Why not use vlookup commands on sheet1 as well?

--
Regards,
Tom Ogilvy

"briank" wrote in message
...
I am entering parameters in worksheet 1 (i.e. Jones) and corresponding

data
in worksheet 2 is based, through vlookup commands on these parameters.

I
would like to enter code (preferably at the click of a button on

worksheet
1)
to go to worksheet 2, look down Column A for the number 1 (there will

only
be
one) and copy paste values that data on that row only and then return

back
to
worksheet 1. This automation would certainly speed up this lengthy

process.
Any thoughts?

Worksheet 2
0 Smith 9.98 5.67 4.35
1 Jones 6.57 3.21 8.65
0 Ranz 2.98 7.57 2.22






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Copy/Paste Values

Tom,
Yes, my earlier verbage was not precise. Let me clarify. I have in
worksheet(2) several rows of vlookups. Only one of these rows (in Column A)
has the number 1 (conditional statement) - all others have zero. It is this
number 1 that I would like the code to search for (i.e. row 8) and thus go to
row 8 and copy/paste values from Column A to Column P. After this, the
parameters in worksheet(1) will be changed and the start the process all over
again (roughly 100 times). Much thanks in advance for helping me in this
matter.

"Tom Ogilvy" wrote:

You say there will only be one occurance of the number and start right out
with an example that has duplicate numbers.

Assume you enter a number in A1 of sheet1

Private Sub Commandbutton1_Click()
Dim sh1 as Worksheet
Dim sh2 as Worksheet
Dim rng as Range, rng1 as Range
Dim res as Variant
Set sh1 = Worksheets(1)
Set sh2 = Worksheets(2)
set rng = sh2.Range(sh2.Cells(1,1), sh2.Cells(rows.count,1).end(xlup))
res = Application.Match(sh1.Range("A1"),rng,0)
if iserror(res) then
msgbox "Not found"
else
set rng1 = rng(res)
rng1.resize(1,20).copy Destination:=sh1.Range("B1")
end if
End Sub
--
Regards,
Tom Ogilvy

"briank" wrote in message
...
The way that sheet 1 was set up by another manager involves pivot tables

and
only one choice or parameter can be entered at a time. I'm sure a better
setup was possible but at the moment I have to deal with someone else's
development. Is this possible to construct the code to allow for this
automation?

"Tom Ogilvy" wrote:

Why not use vlookup commands on sheet1 as well?

--
Regards,
Tom Ogilvy

"briank" wrote in message
...
I am entering parameters in worksheet 1 (i.e. Jones) and corresponding
data
in worksheet 2 is based, through vlookup commands on these parameters.

I
would like to enter code (preferably at the click of a button on

worksheet
1)
to go to worksheet 2, look down Column A for the number 1 (there will

only
be
one) and copy paste values that data on that row only and then return

back
to
worksheet 1. This automation would certainly speed up this lengthy
process.
Any thoughts?

Worksheet 2
0 Smith 9.98 5.67 4.35
1 Jones 6.57 3.21 8.65
0 Ranz 2.98 7.57 2.22









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy/Paste Values

Private Sub Commandbutton1_Click()
Dim sh1 as Worksheet
Dim sh2 as Worksheet
Dim rng as Range, rng1 as Range
Dim res as Variant
Set sh1 = Worksheets(1)
Set sh2 = Worksheets(2)
set rng = sh2.Range(sh2.Cells(1,1), sh2.Cells(rows.count,1).end(xlup))
res = Application.Match(sh1.Range("A1"),rng,0)
if iserror(res) then
msgbox "Not found"
else
set rng1 = rng(res)
rng1.resize(1,20).copy
sh1.cells(rows.count,"P").End(xlup)(2).PasteSpecia l xlValues
end if
End Sub



--
Regards,
Tom Ogilvy


"briank" wrote in message
...
Tom,
Yes, my earlier verbage was not precise. Let me clarify. I have in
worksheet(2) several rows of vlookups. Only one of these rows (in Column

A)
has the number 1 (conditional statement) - all others have zero. It is

this
number 1 that I would like the code to search for (i.e. row 8) and thus go

to
row 8 and copy/paste values from Column A to Column P. After this, the
parameters in worksheet(1) will be changed and the start the process all

over
again (roughly 100 times). Much thanks in advance for helping me in this
matter.

"Tom Ogilvy" wrote:

You say there will only be one occurance of the number and start right

out
with an example that has duplicate numbers.

Assume you enter a number in A1 of sheet1

Private Sub Commandbutton1_Click()
Dim sh1 as Worksheet
Dim sh2 as Worksheet
Dim rng as Range, rng1 as Range
Dim res as Variant
Set sh1 = Worksheets(1)
Set sh2 = Worksheets(2)
set rng = sh2.Range(sh2.Cells(1,1), sh2.Cells(rows.count,1).end(xlup))
res = Application.Match(sh1.Range("A1"),rng,0)
if iserror(res) then
msgbox "Not found"
else
set rng1 = rng(res)
rng1.resize(1,20).copy Destination:=sh1.Range("B1")
end if
End Sub
--
Regards,
Tom Ogilvy

"briank" wrote in message
...
The way that sheet 1 was set up by another manager involves pivot

tables
and
only one choice or parameter can be entered at a time. I'm sure a

better
setup was possible but at the moment I have to deal with someone

else's
development. Is this possible to construct the code to allow for this
automation?

"Tom Ogilvy" wrote:

Why not use vlookup commands on sheet1 as well?

--
Regards,
Tom Ogilvy

"briank" wrote in message
...
I am entering parameters in worksheet 1 (i.e. Jones) and

corresponding
data
in worksheet 2 is based, through vlookup commands on these

parameters.
I
would like to enter code (preferably at the click of a button on

worksheet
1)
to go to worksheet 2, look down Column A for the number 1 (there

will
only
be
one) and copy paste values that data on that row only and then

return
back
to
worksheet 1. This automation would certainly speed up this

lengthy
process.
Any thoughts?

Worksheet 2
0 Smith 9.98 5.67 4.35
1 Jones 6.57 3.21 8.65
0 Ranz 2.98 7.57 2.22









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
copy / paste as values KRK New Users to Excel 1 March 21st 10 12:49 PM
Copy and paste up to values in last row Scott Excel Discussion (Misc queries) 2 September 23rd 09 10:23 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
VB for copy & paste values (not formula's) Eager2Learn[_10_] Excel Programming 1 June 23rd 04 06:02 AM
How do i compare values from two sheet and copy & paste if values match? rozb Excel Programming 0 March 5th 04 12:06 AM


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