Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
|
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 21st, 2005, 12:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default vb macro output file to excel

Please can remove the error from following coding
it give error line 30 .... OR

It display the missing / un-match values how ?

what is the missing or what is wrong ?

Please help.




Sub SYNCdataSort()

' SYNCdataSort Macro
' For automated input of volume in Synchro format


a = 4

Sheets("synchro").Select

Do Until IsEmpty(Cells(a, 3)) = True

intid = Cells(a, 3)

b = 3
Sheets("base").Select
Do Until IsEmpty(Cells(b, 1)) = True
If Cells(b, 1) = intid Then datid = Cells(b, 2): Exit Do Else b = b + 1
Loop
If Not Cells(b, 1) = intid Then
msg = "Intersection ID not found, please check BASE sheet"
Style = vbOKOnly
Title = Cells(b, 1)
response = MsgBox(msg, Style, Title)
End
End If

Sheets("IDs for AVOL").Select
p = 1
Do Until IsEmpty(Cells(p, 1)) = True
If Cells(p, 1) = intid Then idchk = intid: GoTo 20 Else p = p + 1
Loop

c = 3
Sheets("MTP").Select
Do Until IsEmpty(Cells(c, 2)) = True
If Cells(c, 2) = datid Then GoTo 10 Else c = c + 1
Loop
If Not Cells(c, 2) = datid Then
msg = "Intersection ID not found, please check output Data Sheet"
Style = vbOKOnly
Title = Cells(b, 1)
response = MsgBox(msg, Style, Title)
End
End If

10 d = 3
m = Cells(2, d) 'movement
v = Cells(c, d) 'volume
Dim mov(15), vol(15) As Variant
For j = 0 To 15
mov(j) = m
vol(j) = v
d = d + 1
m = Cells(2, d) 'movement
v = Cells(c, d) 'volume
Next j

Sheets("Synchro").Select
e = 4
For j = 0 To 15
Do Until Cells(3, e) = mov(j) = True
e = e + 1
Loop
Cells(a, e) = vol(j)
e = 4
Next j
GoTo 100

20 Sheets("base").Select
f = 28
h = 28
Do Until Cells(f, 1) = idchk = True
h = h + 1
f = f + 1
Loop
g = 0 ' record for no. of movements
Do While Cells(h, 1) = idchk = True
h = h + 1
g = g + 1
Loop
msync = Cells(f, 3) 'movement synchro
mdata = Cells(f, 4) 'equivalent data movement
Dim ms(100), md(100) As Variant
For k = 0 To (g - 1)
'value of g minus one bec. array considers 0 as record number one
ms(k) = msync 'movement synchro
md(k) = mdata 'equivalent data movement
f = f + 1
msync = Cells(f, 3) 'movement synchro
mdata = Cells(f, 4) 'equivalent data movement
Next k

c = 3
Sheets("MTP").Select
Do Until IsEmpty(Cells(c, 2)) = True
If Cells(c, 2) = datid Then GoTo 30 Else c = c + 1
Loop
If Not Cells(c, 2) = datid Then
msg = "Intersection ID not found, please check output Data Sheet"
Style = vbOKOnly
Title = Cells(b, 1)
response = MsgBox(msg, Style, Title)
End
End If

30 d = 3
Dim avol(100) As Variant
For k = 0 To (g - 1)
Do Until Cells(2, d) = md(k) = True 'using movement code in output data
(error is this line, on this line is stop)

d = d + 1
Loop
avol(k) = Cells(c, d) 'volume for abnormal geometry
d = 3
Next k

Sheets("synchro").Select
e = 4
For k = 0 To (g - 1)
Do Until Cells(3, e) = ms(k) = True 'using Synchro movement code
e = e + 1
Loop
Cells(a, e) = avol(k)
e = 4
Next k

100 a = a + 1
Loop

End Sub


can anybody can help me, I will send Excel file to your e.mail address
(you can give post your e.mail address here)

regards

Mateen
mateenmohd@hotmail.com

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web access from VB Macro in Excel beta_leonis VB How-To 0 August 3rd, 2007 11:30 AM
control Excel VBA macro with a VB 05-designed UI dgr7 Visual Basic 2005 Basics 1 January 17th, 2007 11:29 AM
execute an excel macro via a .vbs file ismailc VB.NET 2002/2003 Basics 1 January 11th, 2007 04:19 PM
VB Macro Excel mateenmohd Excel VBA 6 January 4th, 2006 05:27 AM
AppActivate in a VB macro - Excel 2002 andycub Excel VBA 0 April 7th, 2004 10:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.