Trying to understand this macro without running it.

docops

New Member
Joined
Feb 28, 2021
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Hi all, i am trying to understand what the following macro does without running it.
If someone has knowledge on this and can explain to me in detail what it does and how you know it performs this function (without running it)
it would be much appreciated. I am just trying to learn more on visual basic and I am quite a noob.
Thank you very much.

Sub hello()
Dim FirstInteger As Integer
FirstInteger = 2
For i = 2 To 100000
Cells(1, 2) = Cells(i, 1)
Cells(1, 3) = "=vlookup(B1,D2:D100000,1,0)"
If IsError(Range("c1")) = True Then
Cells(FirstInteger, 4) = Range("B1")
FirstInteger = FirstInteger + 1
End If
If Cells(i + 1, 1) = "" Then
i = 200000
End If
Next i
Range("B1:C1").ClearContents
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Looks like its trying to get a unique list of values in column A, running from A2 down, stopping if there is a blank cell, and placing them in column D. Column D will need to be empty else it will produce incorrect results. Theres a function for that on 365, UNIQUE.
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,040
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top