Get instant live expert help on I need help with string to integer vba

“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you’ll get expert help in seconds.

Our professional experts are available now. Your privacy is guaranteed.

Here are some problems that our users have asked and received explanations on

In excel VBA I have a sub that takes in 3 variables and in running the code generates 5 new variables. I would like to 5 either a single function or 5 different functions to return each of these variables without having redundant code where I have to repeat the same code in all 5 functions. See example below for my sub code: Sub MySub(Input1 as Integer, Input2 as Integer, Input3 as Integer) Dim Output1 as Integer Dim Output2 as Integer Dim Output3 as Double Dim Output4 as Double Dim Output5 as String MyVBACode EndSub
Solved by V. B. in 23 mins
hi, I am stuck in a problem since one week and need help!!! I am running a SQL query in Excel 2010 VBA. The query runs fine but when I use GROUP BY, I get Automation Error. Everything works if I remove Group By but I need to group data. My query looks like: Dim objRs As New ADODB.Recordset Dim output As String Dim trows As Integer Dim ThisTab As Excel.Worksheet Dim tcols As Integer Dim i As Integer Dim sSQL As String ' sSQL = "SELECT * from [Data] where [Rem Scen 2] > 0 and (Now() - [Eval Date]) <=60" sSQL = "SELECT [Emp ID], [Deptt], [Job Types], [Join Date],[Pay 1]+[Pay 2] as [Compensate] from [Data] Group By {Emp ID] With objConn .Provider = "Microsoft.ACE.OLEDB.12.0" .ConnectionString = "Data Source=" & ThisWorkbook.Path & "\" & ThisWorkbook.Name & ";" & _ "Extended Properties=""Excel 12.0 Macro;HDR=YES"";" .Open End With ' Execute once and display... objRs.Open sSQL, objConn
Solved by C. D. in 29 mins
Excel VBA not incrementing the value of a specific cell. Function SayIt(cell1 As Variant, Optional baSync As Boolean, Optional bPurge As Boolean) ThisWorkbook.Worksheets("Latest").Activate Dim Roll As Integer, result2 As String Roll = ThisWorkbook.Worksheets("Latest").Range("d2").Value ' The value of cell D1 is currently 1 MsgBox "Sayit Before ROLL " & Roll Roll = Roll + 1 MsgBox "Sayit After ROLL " & Roll End Function
Solved by A. U. in 20 mins
I have a user function as follows that doesn't work: Function FORMAT8_I(Cells_Dat As Integer) As String FORMAT8_I = Right(" " & Format(Cells_Dat, "0"), 8) End Function When I change the Cells_Dat as a Long it work fine. I tried to debug the problem but it appears that when I have the original code above the cell that activates the function doesn't even go to the VBA function. It simple outputs a #NUM! error.
Solved by K. Q. in 22 mins
I am using a vba code to return multiple values, separated by a column. See below. i would like to have the values returned one line at a time in a column. How do I edit the code to make this happen? As Range, ColumnNumber As Integer) Dim i As Long Dim Result As String For i = 1 To LookupRange.Columns(1).Cells.Count If LookupRange.Cells(i, 1) = Lookupvalue Then For J = 1 To i - 1 If LookupRange.Cells(J, 1) = Lookupvalue Then If LookupRange.Cells(J, ColumnNumber) = LookupRange.Cells(i, ColumnNumber) Then GoTo Skip End If End If Next J Result = Result & " " & LookupRange.Cells(i, ColumnNumber)
Solved by E. E. in 27 mins