Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
547 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Showing blogs 1-20 (out of 28)
Posted by Andrew Gould on 08 May 2024
Posted by Andy Brown on 26 September 2016
Posted by Andy Brown on 17 December 2015
Posted by Andy Brown on 17 December 2015
Posted by Andrew Gould on 26 November 2015
Posted by Andy Brown on 15 September 2014
Posted by Andrew Gould on 24 April 2014
Posted by Andrew Gould on 24 April 2014
Posted by Andrew Gould on 24 April 2014
Posted by Andrew Gould on 24 April 2014
Posted by Andrew Gould on 24 April 2014
Posted by Andrew Gould on 24 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Posted by Andrew Gould on 11 April 2014
Some other pages relevant to the above blogs include:
From: | EDAC-Charlie |
When: | 09 Feb 17 at 15:24 |
Firstly please let me introduce myself, I'm Charlie, I'm new to coding and I have been given a task. The task is to create code to generate discrete part descriptions for every part number our system can generate. I have attached the code that was written to generate the part numbers, I have also attached the code that I am trying to use to generate the descriptions which has compile error type mismatch occurring.
I would very much like to understand the original code and then create new rather than someone writing the code and just accepting that it works, as has happened before, hence the current situation! My first major hurdle is understanding the "i" in for example:
Dim i1 As Long
If Cells(i2, 2) Mod 2 <> 0 And Cells(i4, 4)
and
Next i5
Amongst other areas of the code.
Sub series325()
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim e As Long
Dim i1 As Long
Dim i2 As Long
Dim i3 As Long
Dim i4 As Long
Dim i5 As Long
Dim counter As Long
counter = 1
a = Range("A1").End(xlDown).Row
b = Range("B1").End(xlDown).Row
c = Range("C1").End(xlDown).Row
d = Range("D1").End(xlDown).Row
e = Range("E1").End(xlDown).Row
For i1 = 2 To a
For i2 = 2 To b
For i3 = 2 To c
For i4 = 2 To d
For i5 = 2 To e
If Cells(i2, 2) Mod 2 <> 0 And Cells(i4, 4) Mod 2 = 0 Then GoTo Nexti
If Cells(i2, 2) Mod 2 <> 0 And Cells(i4, 4) = "-2" Then GoTo Nexti
If Cells(i2, 2) > 61 And Cells(i4, 4) = "-1" Then GoTo Nexti
Cells(counter, 10) = Cells(i1, 1) & Cells(i2, 2) & Cells(i3, 3) & Cells(i4, 4) & Cells(i5, 5)
counter = counter + 1
Nexti:
Next i5
Next i4
Next i3
Next i2
Next i1
End Sub
I would like to apply the same method to the descriptions. I was hoping the code below might work, sadly it didn't.
Sub series325PartDescriptionTest()
Dim a As String
Dim b As Long
Dim c As String
Dim d As String
Dim e As String
Dim f As String
Dim g As String
Dim i1 As String
Dim i2 As Long
Dim i3 As String
Dim i4 As String
Dim i5 As String
Dim i6 As String
Dim i7 As String
Dim counter As String
counter = 1
a = Range("A1").End(xlDown).Row
b = Range("B1").End(xlDown).Row
c = Range("C1").End(xlDown).Row
d = Range("D1").End(xlDown).Row
e = Range("E1").End(xlDown).Row
f = Range("F1").End(xlDown).Row
g = Range("G1").End(xlDown).Row
For i1 = 2 To a
For i2 = 2 To b
For i3 = 2 To c
For i4 = 2 To d
For i5 = 2 To e
For i6 = 2 To f
For i7 = 2 To g
If Cells(i2, 2) Mod 2 <> 0 And Cells(i5, 5) Mod 2 = 0 Then GoTo Nexti
If Cells(i2, 2) Mod 2 <> 0 And Cells(i5, 5) = "Double Row formation. " Then GoTo Nexti
Cells(counter, 10) = Cells(i1, 1) & Cells(i2, 2) & Cells(i3, 3) & Cells(i4, 4) & Cells(i5, 5) & Cells(i6, 6) & Cells(i7, 7)
counter = counter + 1
Nexti:
Next i7
Next i6
Next i5
Next i4
Next i3
Next i2
Next i1
End Sub
I am struggling to add the spreadsheets for reference, the formatting falls apart when I use copy & paste.
From: | Andrew G |
When: | 10 Feb 17 at 13:00 |
Hi Charlie, thanks for your question! It's a tricky one to answer in a simple comment like this one because, as you say, you're new to programming. Fortunately, we've created both written and video tutorials on VBA that will help you to understand all of the elements that go into making up the procedure you're trying to create.
This page lists the written articles that are part of our main Excel VBA tutorial. We've written plenty of other articles on more esoteric aspects of the language but the articles in that tutorial will give the core skills you need.
If you'd prefer to watch rather than read, you can see a list of our Excel VBA videos here. The main ones you'll need in order to understand the code you've posted are the videos on Selecting Cells, Variables in VBA, If Statements in VBA and For Next Loops.
I hope that helps!
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.