Posts by Philosophaie
Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.
-
-
I am trying to put arr1 onto Sheet1 but it is giving me this error:
QuoteSub or function not defined.
In module:
CodeFunction func(ByRef arr As Variant) As Variant Dim arr1(8) As Variant For k = 1 To 8 arr1(k) = arr(7 - k) Next k Call printarr(arr1) func = arr1(8) & arr1(7) & arr1(6) & arr1(5) & arr1(4) & arr1(3) & arr1(2) & arr1(1) End Function
In Sheet1:
CodeSub printarr(ByRef arr As Variant) With Sheets("Sheet1") For k = 1 To Len(arr) .Cells(7, k + 3) = arr(k) Next k End With End Sub
'In cell 5,3 -
Re: Printing an array from a function
Quote from rory;626249You will need to array enter your function into all the output cells at once.
How do you enter the array output in more than one cell?
-
I want to create a function in a module that will read an array from sheet1 preform an operation on it then return the result to the spreadsheet in a defined amount of cells in this example 8.
In Module1:
CodeFunction func1(ByRef arrayA()) Dim arrayB(8) For k = 0 To 7 arrayB(k + 1) = arrayA(k) * 2 Next k func1 = arrayB End Function
In sheet1:
The input is D3:K3, arrayA.
How does the resultant arrayB get populated onto the spreadsheet?
-
-
Re: WorkSheet_Change not updating
Then you got:
Quote("InsertOrDelete")
or something like that when you execute row delete or insert.
or where am I going wrong is it with the whole thing.
-
Re: WorkSheet_Change not updating
You have change a cell not a whole row or something else.
I have put in "Sheet1" in VBA it just:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox ("InsertOrDelete")
End Suband nothing happens when I right click on the row #s just to the right of columnA and Select "Insert".
You try.
-
When you delete or insert a row (right click the the row #s on the left before the first column):
Sub WorkSheet_Change(Byval Target As Range)
'code
End Subdoes not detect that insert or delete row so nothing changes and Access is not updated.
Is there some way of detecting when the insert row or delete row has been activated to do something that will make WorkSheet_Change notice.
-
Re: Open a ".mdf" file in Access thru Excel VBA
This does not work as written.
Access just flashes and does not become visible.
How do you keep it on the desktop and open Access to a table?
-
How do you open a ".mdf" file like "Northwind.mdf" in Access thru Excel VBA?
-
-
Re: create a Recordset and have it delete all records in an Access table
Could you add something to it "ao." open the Access Application to the desktop and open to Table1 after the Delete is complete.
-
-
In Excel VBA I would like to create a Recordset and have it delete all records in an Access table keeping the fields.
-
Re: Delete all the rows that have blanks in both columns "D" and "F"
Thanx
-
-
In VBA Excel transferring data from Excel to Access.
I want to know how to increment the [ID] for each value of the range. [ID] is the Primary Key.
I have tried "NULL".
I have tried adding "n=n+1" after the "for each" and "thisSQL = "INSERT INTO... VALUES (" & n & ",..."
CodeFor Each value In Range("D5:D" & Cells(Rows.Count, "D").End(xlUp).Row) accDateSub = Cells(value.Row, 1) accDescSub = Cells(value.Row, 2) accSub = Cells(value.Row, 3) thisSQL = "INSERT INTO [Table1] ([ID], [Date], [Desc], [Data]) VALUES ("[U]What goes here?[/U] ", #" & Format(CDate(accDate), "MM/DD/YY") & "#, '" & accDesc & "', " & accData & ");" conn.Execute CommandText:=thisSQLNext
-
Re: Troubleshoot a INSERT INTO statement in Excel
The error code is"
QuoteRun-time error'-2147217913(80040e07)':
Syntax error in date in query expression'#'. -
Re: Troubleshoot a INSERT INTO statement in Excel
I ran it with Debug.Print thisSQL. Got a "Object Required" error
Here are my Fields:
ID, DateSub, DescSub, Sub, RunningTotal, Add, DescAdd, and DateAdd.
Eight in total.
Could someone show me where my syntax is Wrong.CodethisSQL = "INSERT INTO [a Chase Table] ([ID], [DateSub], [DescSub], [Sub], [RunningTotal], [Add], [DescAdd], [DateAdd]) VALUES (" & n & ", #" & Format(accDateSub, "yyyy/mm/dd") & "#, '" & accDescSub & "', " & accSub & ", " & accRunTotal & ", " & accAdd & ", '" & accDescAdd & "', #" & Format(accDateAdd, "yyyy/mm/dd") & "#);"
Is it possible the syntax for the Dates are wrong?
-
Everything is functioning correctly except to "INSERT INTO" statement. Could someone help troubleshoot it with me.
Code
Display MoreDim conn As New ADODB.Connection conn.Open ConnectionString:="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\Users\Philosophaie\Documents\a High Priority\a SQL\a Chase.accdb;" Dim value As Range For Each value In Range("E5:E" & Cells(Rows.Count, "E").End(xlUp).Row) n = n + 1 accDateSub = Cells(value.Row, 2) accDescSub = Cells(value.Row, 3) accSub = -Cells(value.Row, 4) accRunTotal = Cells(value.Row, 5) accAdd = Cells(value.Row, 6) accDescAdd = Cells(value.Row, 7) accDateAdd = Cells(value.Row, 8) thisSQL = "INSERT INTO [a Chase Table] VALUES ([" & n & "], [#" & Format(accDateSub, "yyyy/mm/dd") & "#], ['" & accDescSub & "'], [" & accSub & "], [" & accRunTotal & "]), [" & accAdd & "], ['" & accDescAdd & "'], [#" & Format(accDateAdd, "yyyy/mm/dd") & "#]);" conn.Execute CommandText:=thisSQL Next