Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to create insert statements?


Hi,

I'm a bit of a newbie to excel and was wondering if anyone can help m
create an insert script for my database?

At the moment on my worksheet I have the following:


Code
-------------------


productname productid remote control spy fitness other
testa 1 1
testb 2 1 1
testc 3 1



-------------------


I am looking to create this:

insert into category_lookup (productid, category) values (1, 'remot
control');
insert into category_lookup (productid, category) values (2, 'remot
control');
insert into category_lookup (productid, category) values (2, 'spy');
insert into category_lookup (productid, category) values (3
'fitness');

and so on......

Basically a 1 in any of my categories means an insert statement i
needed.

Does anyone know the simple vba to do this or a formula??

Hope you can help

Thanks

Chri

--
mooreeasyvib
-----------------------------------------------------------------------
mooreeasyvibe's Profile: http://www.excelforum.com/member.php...fo&userid=2681
View this thread: http://www.excelforum.com/showthread.php?threadid=40072

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default How to create insert statements?

hi,
you left out something. where are you getting the data to insert?

Regards
FSt1

"mooreeasyvibe" wrote:


Hi,

I'm a bit of a newbie to excel and was wondering if anyone can help me
create an insert script for my database?

At the moment on my worksheet I have the following:


Code:
--------------------


productname productid remote control spy fitness other
testa 1 1
testb 2 1 1
testc 3 1



--------------------


I am looking to create this:

insert into category_lookup (productid, category) values (1, 'remote
control');
insert into category_lookup (productid, category) values (2, 'remote
control');
insert into category_lookup (productid, category) values (2, 'spy');
insert into category_lookup (productid, category) values (3,
'fitness');

and so on......

Basically a 1 in any of my categories means an insert statement is
needed.

Does anyone know the simple vba to do this or a formula??

Hope you can help

Thanks

Chris


--
mooreeasyvibe
------------------------------------------------------------------------
mooreeasyvibe's Profile: http://www.excelforum.com/member.php...o&userid=26818
View this thread: http://www.excelforum.com/showthread...hreadid=400728


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to create insert statements?


All of the data will just be on an excel worksheet.

All I want to do is loop over each row in the sheet and write the
insert statements to an external file.

Thanks for your help

Chris


--
mooreeasyvibe
------------------------------------------------------------------------
mooreeasyvibe's Profile: http://www.excelforum.com/member.php...o&userid=26818
View this thread: http://www.excelforum.com/showthread...hreadid=400728

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
Can I use Exel to create Financial Statements? vinessa Reid Excel Worksheet Functions 2 December 6th 06 01:36 PM
IF statements - use to insert/delete rows? WRM Excel Worksheet Functions 5 October 21st 06 08:55 PM
How to create a form to insert a hyerlink.VBA code to create a for karthi Excel Discussion (Misc queries) 0 July 5th 06 11:26 AM
Can I create a formula with more than 8 IF statements? Paul P Excel Discussion (Misc queries) 2 January 17th 06 12:08 PM
How do I create If then statements Jniedfeldt Excel Discussion (Misc queries) 2 October 6th 05 09:46 PM


All times are GMT +1. The time now is 06:35 AM.

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"