Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default VBA-writing a macro

As usual, you should copy paste your coding efforts for comments.

--
Don Guillett
SalesAid Software

"benb" wrote in message
...
I am trying to right a macro that will find what new trades that have been
added to an existing table, and then plug the ID for any new trades into a
separate table.

To do this I have four tables to work with. The first contains all of the
trade ID's as of today. The second is the same table as of yesterday.

The
third contains more information related to each trade (e.g. counterparty

and
portfolio). Finally, the fourth table is where I want to plug in the new
trade ID's belonging to a certain counterparty and portfolio.

In Excel to do this manually I use a series of Vlookups. I've tried to
accomplish the same thing with If/Then statements and Do Until Loops, but

for
some reason it isn't working. I've spent two days already trying

different
variations on the theme with no success. Can anybody suggest some script

to
help?

To try and rephrase: I need to look up a value in one table. If I find it
then I move on to the next value. If I don't find then I need to lookup

in
another table the corresponding counterparty and portfolio. If it's from

one
portfolio, I need to plug the ID into one table. If it's from another
portfolio, I need to plug it into a different one. If it's from neither

then
i just need to move on to the next value.

Thanks.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA-writing a macro

This is what has come the closest to working, but it seems to paste
everything from "FBISNL" rather than just the new entries that do not already
appear, and it pastes nothing from the others (e.g."FBXSNL"). Thanks for
your help.

v1 = Sheets("Reconciliation").Cells(71, 10).Value
v2 = Sheets("Reconciliation").Cells(71, 23).Value
r = 4
x = 4
y = 4

For r = 4 To n
If Sheets("CDS Reports").Rows(r).Cells(1).Value < "" Then
Do Until _
Sheets("Testing").Rows(y).Cells(17).Value = Sheets("CDS
Reports").Rows(r).Cells(1).Value _
Or Sheets("Testing").Rows(y).Cells(17).Value = ""
y = y + 1
Loop
If Sheets("Testing").Rows(y).Cells(17).Value = "" Then
Do Until _
Sheets("Oasys Report").Rows(x).Cells(6).Value = Sheets("CDS
Reports").Rows(r).Cells(1).Value
x = x + 1
Loop

If Sheets("Oasys Report").Rows(x).Cells(9) = "BOLSA" Then
If Sheets("Oasys Report").Rows(x).Cells(4) = "FBISNL" Or _
Sheets("Oasys Report").Rows(x).Cells(4) = "FBISML" Then
Sheets("Oasys Report").Rows(x).Cells(6).copy
Sheets("Reconciliation").Cells(73 + v1, 11).PasteSpecial
Paste:=xlPasteValues
v1 = v1 + 1
End If

If Sheets("Oasys Report").Rows(x).Cells(4) = "FBXSNL" Or _
Sheets("Oasys Report").Rows(x).Cells(4) = "FBXSML" Then
Sheets("Oasys Report").Rows(x).Cells(6).copy
Sheets("Reconciliation").Cells(73 + v2, 22).PasteSpecial
Paste:=xlPasteValues
v2 = v2 + 1
End If
End If
End If
End If
nxt: Next r

"Don Guillett" wrote:

As usual, you should copy paste your coding efforts for comments.

--
Don Guillett
SalesAid Software

"benb" wrote in message
...
I am trying to right a macro that will find what new trades that have been
added to an existing table, and then plug the ID for any new trades into a
separate table.

To do this I have four tables to work with. The first contains all of the
trade ID's as of today. The second is the same table as of yesterday.

The
third contains more information related to each trade (e.g. counterparty

and
portfolio). Finally, the fourth table is where I want to plug in the new
trade ID's belonging to a certain counterparty and portfolio.

In Excel to do this manually I use a series of Vlookups. I've tried to
accomplish the same thing with If/Then statements and Do Until Loops, but

for
some reason it isn't working. I've spent two days already trying

different
variations on the theme with no success. Can anybody suggest some script

to
help?

To try and rephrase: I need to look up a value in one table. If I find it
then I move on to the next value. If I don't find then I need to lookup

in
another table the corresponding counterparty and portfolio. If it's from

one
portfolio, I need to plug the ID into one table. If it's from another
portfolio, I need to plug it into a different one. If it's from neither

then
i just need to move on to the next value.

Thanks.




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
Writing a macro RB[_2_] Excel Worksheet Functions 0 January 14th 08 05:40 PM
writing macro CN New Users to Excel 2 August 2nd 05 06:16 PM
Need Help writing a macro TwEaKFrEaK[_4_] Excel Programming 1 August 24th 04 10:16 PM
help in writing a macro slim[_2_] Excel Programming 1 February 13th 04 01:41 AM
Macro Writing Help? Richard[_22_] Excel Programming 2 December 31st 03 07:39 PM


All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"