Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are expecting a <code>String</code>/Text value from your input box then you should specify it,</p> <pre><code>Dim column1 As String 'display an input box asking for column column1 = InputBox("Please enter column to ckeck", "Range to Check", , , , 2) </code></pre> <p>Instead of juggling with a String here, why don't you just use the <code>Range</code> object where user can simply click on either full range or one cell in that column you want to check.. </p> <p>Using a range to get the inputbox data: You main issue seems to be setting range to check column in formula.</p> <pre><code>Option Explicit Sub LookForDuplicates() Dim LastRow As Long, StartRow as Long Dim column1 As Range, column2 As Range Set column1 = Application.InputBox("Please enter _ column to ckeck", "Range to Check", , , , , , 8) If column1 Is Nothing Then MsgBox "No column entered" Exit Sub End If Set column2 = Application.InputBox("Please _ enter column to insert results", _ "Range to Output Results", , , , , , 8) If column2 Is Nothing Then MsgBox "No column entered" Exit Sub End If LastRow = Cells(Rows.Count, column1.Column).End(xlUp).Row '--updated here StartRow = column2.Row '-- here a new code added, assuming that you will have at least one row for column titles With column2 .FormulaR1C1 = "=COUNTIF(R" &amp; column1.Row _ &amp; "C[-1]:R" &amp; LastRow + 2 &amp; "C[-1],RC[-1])" .AutoFill Destination:=column2.Resize(LastRow - StartRow, 1) End With column2.Offset(-1, 0).FormulaR1C1 = "Duplicates" End Sub </code></pre> <p>Output:</p> <p><img src="https://i.stack.imgur.com/ewk5u.jpg" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload