Get instant live expert help on I need help with excel vba dim

“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

i need assist with some vba coding Dim ws As Worksheet Dim irow As Long Set ws = Sheets("sheet1") irow = ws.Cells(ws.Rows.Count, 1).End(x1up).Offset(1, 0).Row The last line keeps coming out as an error?
Solved by I. H. in 14 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
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
Sub EnableOutlining() 'Update 20140603 Dim xWs As Worksheet Set xWs = Application.ActiveSheet Dim xPws As String xPws = Application.InputBox("Password:", xTitleId, "", Type:=2) xWs.Protect Password:=xPws, Userinterfaceonly:=True xWs.EnableOutlining = True End Sub This is the VBA code i am using to be able to group and ungroup things in excel while the sheet is protected. when i close and reopen the code no longer works
Solved by I. B. in 27 mins
Hi I have a piece of code that suddenly stop working: All code in the sheet...cell is not working Private Sub Receipt_Click() Dim customername As String Dim customeraddress As String Dim invoicenumber As String Dim r As Long Dim mydate As String Dim path As String Dim myfilename As String lastrow = Sheets("01").Range("B" & Rows.Count).End(xlUp).Row r = 5 For r = 5 To lastrow If Cells(r, 15).Value = "done" Then GoTo nextrow Product = Sheets("01").Range("R2").Value ...working studentname = Sheets("01").Cells(r, 2).Value...not working Cells(r, 15).Value = "done"...not working
Solved by E. D. in 14 mins