Click here to Skip to main content
15,891,777 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Insert/Update statement Pin
Thomas Krojer11-Nov-09 1:53
Thomas Krojer11-Nov-09 1:53 
GeneralRe: Insert/Update statement Pin
shefa' isied11-Nov-09 1:59
shefa' isied11-Nov-09 1:59 
AnswerRe: Insert/Update statement Pin
John M Bundy11-Nov-09 2:25
John M Bundy11-Nov-09 2:25 
AnswerRe: Insert/Update statement Pin
Dave Kreskowiak11-Nov-09 7:25
mveDave Kreskowiak11-Nov-09 7:25 
AnswerRe: Insert/Update statement Pin
Shameel11-Nov-09 23:10
professionalShameel11-Nov-09 23:10 
GeneralRe: Insert/Update statement Pin
loyal ginger17-Nov-09 6:12
loyal ginger17-Nov-09 6:12 
GeneralRe: Insert/Update statement Pin
Shameel17-Nov-09 7:45
professionalShameel17-Nov-09 7:45 
QuestionInsert formula into a vairable range of cells in Excel from VB Pin
nhsal6911-Nov-09 1:22
nhsal6911-Nov-09 1:22 
Hi there,

I have the following code which takes data from SQL and then adds it to a Excel Spreadsheet.

This all works fine, but I need to subtract the column "K" from Column "L" and store it in "M"

It inserts the formula into the required number of rows (dependant of the value   "R2") but the formula shows as =(K & D1)-(L & D1) in each cell and not for example =(K 28)-(L 28) etc....

Can you help??

Thanks




<code>           
Dim SQlQuery2 As String = "select * from growth where Name <> '[Files]'order by FullPath"
            Dim SQLCommand2 As New SqlCommand(SQlQuery2, myConn)
            Dim SQlReader2 As SqlDataReader = SQLCommand2.ExecuteReader
            Dim R2 As Integer = 27
            While SQlReader2.Read
                  R2 = R2 + 1
                  osheet.Range("I" & R2).Value = SQlReader2.GetValue(0).ToString
                  osheet.Range("I" & R2).BorderAround(8)
                  osheet.Range("J" & R2).Value = SQlReader2.GetValue(1).ToString
                  osheet.Range("J" & R2).BorderAround(8)
                  osheet.Range("K" & R2).Value = SQlReader2.GetValue(2).ToString
                  osheet.Range("K" & R2).BorderAround(8)
                  osheet.Range("L" & R2).Value = SQlReader2.GetValue(3).ToString
                  osheet.Range("L" & R2).BorderAround(8)
            End While
            SQlReader2.Close()
            SQlReader2 = Nothing

            Dim D1 As Integer = 28

            Do Until D1 = R2

                  osheet.Range("M" & D1).Formula = "=(""K"" & D1)-(""L"" & D1)"
                  D1 = D1 + 1
            Loop
</code>
AnswerRe: Insert formula into a vairable range of cells in Excel from VB Pin
John M Bundy11-Nov-09 2:36
John M Bundy11-Nov-09 2:36 
GeneralRe: Insert formula into a vairable range of cells in Excel from VB Pin
nhsal6911-Nov-09 2:58
nhsal6911-Nov-09 2:58 
QuestionRunning Command Line Files Pin
EvanSaunders10-Nov-09 23:18
EvanSaunders10-Nov-09 23:18 
AnswerRe: Running Command Line Files Pin
Johan Hakkesteegt11-Nov-09 0:40
Johan Hakkesteegt11-Nov-09 0:40 
GeneralRe: Running Command Line Files Pin
EvanSaunders12-Nov-09 22:45
EvanSaunders12-Nov-09 22:45 
AnswerRe: Running Command Line Files Pin
Shameel11-Nov-09 23:12
professionalShameel11-Nov-09 23:12 
GeneralRe: Running Command Line Files Pin
EvanSaunders12-Nov-09 22:46
EvanSaunders12-Nov-09 22:46 
QuestionComboBox BUG!!!??? Pin
huamala10-Nov-09 23:07
huamala10-Nov-09 23:07 
AnswerRe: ComboBox BUG!!!??? Pin
Dave Kreskowiak11-Nov-09 7:19
mveDave Kreskowiak11-Nov-09 7:19 
GeneralRe: ComboBox BUG!!!??? Pin
huamala11-Nov-09 22:53
huamala11-Nov-09 22:53 
GeneralRe: ComboBox BUG!!!??? Pin
huamala11-Nov-09 23:29
huamala11-Nov-09 23:29 
GeneralRe: ComboBox BUG!!!??? Pin
Dave Kreskowiak12-Nov-09 3:49
mveDave Kreskowiak12-Nov-09 3:49 
GeneralRe: ComboBox BUG!!!??? Pin
huamala12-Nov-09 4:07
huamala12-Nov-09 4:07 
QuestionHow to disable numeric characters? Please help. Pin
MarkSquall10-Nov-09 21:41
MarkSquall10-Nov-09 21:41 
AnswerRe: How to disable numeric characters? Please help. Pin
Johan Hakkesteegt10-Nov-09 22:47
Johan Hakkesteegt10-Nov-09 22:47 
QuestionDelete a node with double-clicking on it Pin
Milad.Biroonvand10-Nov-09 19:35
Milad.Biroonvand10-Nov-09 19:35 
AnswerRe: Delete a node with double-clicking on it Pin
Christian Graus10-Nov-09 19:36
protectorChristian Graus10-Nov-09 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.