Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Copy/Select a Row

Hello,
I'm retrieving data from SQL and creating a table from, lets say, columns
A:E, the first column contains a product serial number (unique) and the
following columns have the cost of diferent chemicals used on the product
fabrications, lets say, ChemA, ChemB, ChemC and ChemD. Using a Combo Box
looking at the column A for the ListFillRange, I select a product from the
list and put it on the cell F1(LinkedCell). What do I need to do to copy all
the cells (Chems) that belong to that particular chosen product?, in other
words, I want to copy all the Chemicals used for that product from cell F1 to
F5?

Thanks
--
Cesar
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy/Select a Row

I like using the Import External data wizard for creating my macros.

1) Start Recording a macro from worksheet menu Tools - Macro - Record New
Macro
2) Import Data from worksheet menu Data - Import External Data - Mew Web
Query or New Database Query. Select the options you want from the wazard
menues. The last menu where you select finish you can use the Query Editor
to see the SQL statements by select Edit Query
3) Stop Recording from worksheet menu Tools - Macro - Stop Recording.


You can now edit the recorded macro as required.

"Cesar" wrote:

Hello,
I'm retrieving data from SQL and creating a table from, lets say, columns
A:E, the first column contains a product serial number (unique) and the
following columns have the cost of diferent chemicals used on the product
fabrications, lets say, ChemA, ChemB, ChemC and ChemD. Using a Combo Box
looking at the column A for the ListFillRange, I select a product from the
list and put it on the cell F1(LinkedCell). What do I need to do to copy all
the cells (Chems) that belong to that particular chosen product?, in other
words, I want to copy all the Chemicals used for that product from cell F1 to
F5?

Thanks
--
Cesar

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Copy/Select a Row

Thanks Joel for your answer, but that's not what I was looking for, I
probably didn't explain my problem right.
I have no problems retrieving the data from SQL, I even go back to the Query
and modify my request with some criteria, etc. My problem is once I pull all
the data that I want into Excel like I said, from columns A:E, (Column A
-product serial number, Column B,C,D,E show the cost of diferent chemicals
used on the product fabrication, ChemA, Chem B, ChemC and ChemD). I need to
select (I should say the User) a specific product from this list and paste
all the 5 cells into a different location (F1:J1), for instance, if the
product that I select is in the cell A10, I want to copy cells
A10,B10,C10,D10 E10 into F1:J1. I have to give the User the choice of
view/select which product he want to copy. I was using a Combo Box to do this
function, with a drop down list looking at the column A for the ListFillRange
parameter and F1 as LinkedCell parameter. What do I need to do to copy all
the cell asociated with that chosen Product (A10:E10) and paste in the cells
F1:F5?
Is there a different way to do this? I'm not sure but I think is something
related with the ColumnBound or Columncount parameters on the combo Box that
can give me what I want.
Thanks again,
--
Cesar


"Joel" wrote:

I like using the Import External data wizard for creating my macros.

1) Start Recording a macro from worksheet menu Tools - Macro - Record New
Macro
2) Import Data from worksheet menu Data - Import External Data - Mew Web
Query or New Database Query. Select the options you want from the wazard
menues. The last menu where you select finish you can use the Query Editor
to see the SQL statements by select Edit Query
3) Stop Recording from worksheet menu Tools - Macro - Stop Recording.


You can now edit the recorded macro as required.

"Cesar" wrote:

Hello,
I'm retrieving data from SQL and creating a table from, lets say, columns
A:E, the first column contains a product serial number (unique) and the
following columns have the cost of diferent chemicals used on the product
fabrications, lets say, ChemA, ChemB, ChemC and ChemD. Using a Combo Box
looking at the column A for the ListFillRange, I select a product from the
list and put it on the cell F1(LinkedCell). What do I need to do to copy all
the cells (Chems) that belong to that particular chosen product?, in other
words, I want to copy all the Chemicals used for that product from cell F1 to
F5?

Thanks
--
Cesar

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy/Select a Row

Product = Combobox1.Text
Set c = Columns("A").Find(What:=Product, _
LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Range("A" & c.Row & ":E" & c.Row).Copy
Range("F1").PasteSpecial _
Paste:=xlPasteValues, _
Transpose:=True


"Cesar" wrote:

Thanks Joel for your answer, but that's not what I was looking for, I
probably didn't explain my problem right.
I have no problems retrieving the data from SQL, I even go back to the Query
and modify my request with some criteria, etc. My problem is once I pull all
the data that I want into Excel like I said, from columns A:E, (Column A
-product serial number, Column B,C,D,E show the cost of diferent chemicals
used on the product fabrication, ChemA, Chem B, ChemC and ChemD). I need to
select (I should say the User) a specific product from this list and paste
all the 5 cells into a different location (F1:J1), for instance, if the
product that I select is in the cell A10, I want to copy cells
A10,B10,C10,D10 E10 into F1:J1. I have to give the User the choice of
view/select which product he want to copy. I was using a Combo Box to do this
function, with a drop down list looking at the column A for the ListFillRange
parameter and F1 as LinkedCell parameter. What do I need to do to copy all
the cell asociated with that chosen Product (A10:E10) and paste in the cells
F1:F5?
Is there a different way to do this? I'm not sure but I think is something
related with the ColumnBound or Columncount parameters on the combo Box that
can give me what I want.
Thanks again,
--
Cesar


"Joel" wrote:

I like using the Import External data wizard for creating my macros.

1) Start Recording a macro from worksheet menu Tools - Macro - Record New
Macro
2) Import Data from worksheet menu Data - Import External Data - Mew Web
Query or New Database Query. Select the options you want from the wazard
menues. The last menu where you select finish you can use the Query Editor
to see the SQL statements by select Edit Query
3) Stop Recording from worksheet menu Tools - Macro - Stop Recording.


You can now edit the recorded macro as required.

"Cesar" wrote:

Hello,
I'm retrieving data from SQL and creating a table from, lets say, columns
A:E, the first column contains a product serial number (unique) and the
following columns have the cost of diferent chemicals used on the product
fabrications, lets say, ChemA, ChemB, ChemC and ChemD. Using a Combo Box
looking at the column A for the ListFillRange, I select a product from the
list and put it on the cell F1(LinkedCell). What do I need to do to copy all
the cells (Chems) that belong to that particular chosen product?, in other
words, I want to copy all the Chemicals used for that product from cell F1 to
F5?

Thanks
--
Cesar

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Copy/Select a Row

Thanks! that works perfect!!
--
Cesar


"Joel" wrote:

Product = Combobox1.Text
Set c = Columns("A").Find(What:=Product, _
LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
Range("A" & c.Row & ":E" & c.Row).Copy
Range("F1").PasteSpecial _
Paste:=xlPasteValues, _
Transpose:=True


"Cesar" wrote:

Thanks Joel for your answer, but that's not what I was looking for, I
probably didn't explain my problem right.
I have no problems retrieving the data from SQL, I even go back to the Query
and modify my request with some criteria, etc. My problem is once I pull all
the data that I want into Excel like I said, from columns A:E, (Column A
-product serial number, Column B,C,D,E show the cost of diferent chemicals
used on the product fabrication, ChemA, Chem B, ChemC and ChemD). I need to
select (I should say the User) a specific product from this list and paste
all the 5 cells into a different location (F1:J1), for instance, if the
product that I select is in the cell A10, I want to copy cells
A10,B10,C10,D10 E10 into F1:J1. I have to give the User the choice of
view/select which product he want to copy. I was using a Combo Box to do this
function, with a drop down list looking at the column A for the ListFillRange
parameter and F1 as LinkedCell parameter. What do I need to do to copy all
the cell asociated with that chosen Product (A10:E10) and paste in the cells
F1:F5?
Is there a different way to do this? I'm not sure but I think is something
related with the ColumnBound or Columncount parameters on the combo Box that
can give me what I want.
Thanks again,
--
Cesar


"Joel" wrote:

I like using the Import External data wizard for creating my macros.

1) Start Recording a macro from worksheet menu Tools - Macro - Record New
Macro
2) Import Data from worksheet menu Data - Import External Data - Mew Web
Query or New Database Query. Select the options you want from the wazard
menues. The last menu where you select finish you can use the Query Editor
to see the SQL statements by select Edit Query
3) Stop Recording from worksheet menu Tools - Macro - Stop Recording.


You can now edit the recorded macro as required.

"Cesar" wrote:

Hello,
I'm retrieving data from SQL and creating a table from, lets say, columns
A:E, the first column contains a product serial number (unique) and the
following columns have the cost of diferent chemicals used on the product
fabrications, lets say, ChemA, ChemB, ChemC and ChemD. Using a Combo Box
looking at the column A for the ListFillRange, I select a product from the
list and put it on the cell F1(LinkedCell). What do I need to do to copy all
the cells (Chems) that belong to that particular chosen product?, in other
words, I want to copy all the Chemicals used for that product from cell F1 to
F5?

Thanks
--
Cesar

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 an offset value when select [email protected] Excel Programming 0 August 7th 07 04:55 PM
Not using select for copy and paste damorrison Excel Discussion (Misc queries) 2 April 8th 07 08:41 PM
How Do I Copy Only Select Data? Randy Excel Programming 4 February 16th 07 06:54 PM
Select every other Row to copy/cut???? Too much data - Too little time Excel Discussion (Misc queries) 3 December 8th 05 10:21 PM
Select copy Jeff Excel Discussion (Misc queries) 1 December 1st 04 09:15 PM


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