help me out plz?

Y

yousuf555

hi ,

Using macros i am trying to make a database form.What i am doing i
i am putting data into primary excel sheet (INPUT.xls) and coverting i
into (Book1.xls)that is the other excel sheet.My problem is that
have 20 rows in the primary excel sheet but when they are less than 2
(consider 18) the last two rows 19 and 20 still remain there.

Can anyone one help me out??


futher more can anyone tell me how to upload excel file into MS SQ
server


Thanks and Regards


THE CODE IS AS FOLLOWS




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


Private Sub CommandButton1_Click()
'
' Macro1 Macro
' Macro recorded 6/23/2005 by bits
'

'
Dim counter As Integer
Dim i As Integer
Dim n As Integer

n = 1
While Workbooks("input.xls").Worksheets("sheet1").Cells(n, 1) <
""
n = n + 1
Wend
Workbooks("file2.xls").Worksheets("sheet1").Range("A1")
Workbooks("input.xls").Worksheets("sheet1").Range("A1")
Workbooks(" file2.xls").Worksheets("sheet1").Range("B1")
Workbooks("input.xls").Worksheets("sheet1").Range("A2")
Workbooks("file2.xls").Worksheets("sheet1").Range("C1") = Workbooks(
input.xls").Worksheets("sheet1").Range("C2")
Workbooks("file2.xls").Worksheets("sheet1").Range("D1")
Workbooks("input.xls").Worksheets("sheet1").Range("F2")
Workbooks("file2.xls").Worksheets("sheet1").Range("E1")
Workbooks("input.xls").Worksheets("sheet1").Range("A3")

For counter = 2 To n - 4
Workbooks(" file2.xls").Worksheets("sheet1").Cells(counter, 1)
Workbooks("input.xls").Worksheets("sheet1").Cells(1, 2)
Workbooks("file2.xls").Worksheets("sheet1").Cells(counter, 2)
Workbooks(" input.xls").Worksheets("sheet1").Cells(2, 2)
Workbooks("file2.xls").Worksheets("sheet1").Cells(counter, 5)
Workbooks("input.xls").Worksheets("sheet1").Cells(3, 2)
Next counter

For counter = 4 To n - 1
For i = 1 To 6
Workbooks("file2.xls").Worksheets("sheet1").Cells(counter - 3, i
5).Value = Workbooks("input.xls").Worksheets("sheet1").Cells(counter
i).Value
Next i
Next counter

Windows("file2.xls").Activate

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top