PC Review


Reply
Thread Tools Rate Thread

Copy/Select a Row

 
 
Cesar
Guest
Posts: n/a
 
      15th Dec 2008
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      15th Dec 2008
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 With Quote
 
Cesar
Guest
Posts: n/a
 
      16th Dec 2008
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 With Quote
 
Joel
Guest
Posts: n/a
 
      17th Dec 2008
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 With Quote
 
Cesar
Guest
Posts: n/a
 
      17th Dec 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Select all, copy and paste doesn't copy the header Suzanne S. Barnhill Microsoft Word Document Management 1 18th Jan 2007 10:32 PM
select vs copy Diane Windows XP Basics 2 7th Apr 2004 08:40 PM
Select & copy using VBA Meenu Microsoft Outlook VBA Programming 2 15th Nov 2003 04:34 PM
Select All and Copy Ashok Microsoft Powerpoint 1 11th Nov 2003 02:41 AM
copy on select Richard Freeware 8 13th Oct 2003 06:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 PM.