Addictions
Board Regular
- Joined
- May 27, 2018
- Messages
- 60
- Office Version
- 365
Hello,
I am trying to find VBA code which would find a header by name and then autofill that column from input box value to the last row.
Currently I am using below code to replace value in column PostalCode by value from inputbox. It replaces "United Kingdom" in Column PostalCode with value from inputbox. However I would want to autofill that column from inputbox instead of replacing it because value maybe different than "United Kingdom".
Sub Test()
Dim i As String
Dim k As String
Dim rngAddress As Range
i = "United Kingdom"
k = InputBox("Provide Postal Code")
Set rngAddress = Range("1:1").Find("PostalCode")
Range(rngAddress, rngAddress.End(xlDown)).Replace what:=i, replacement:=k, lookat:=xlPart, MatchCase:=False
End Sub
I am trying to find VBA code which would find a header by name and then autofill that column from input box value to the last row.
Currently I am using below code to replace value in column PostalCode by value from inputbox. It replaces "United Kingdom" in Column PostalCode with value from inputbox. However I would want to autofill that column from inputbox instead of replacing it because value maybe different than "United Kingdom".
Sub Test()
Dim i As String
Dim k As String
Dim rngAddress As Range
i = "United Kingdom"
k = InputBox("Provide Postal Code")
Set rngAddress = Range("1:1").Find("PostalCode")
Range(rngAddress, rngAddress.End(xlDown)).Replace what:=i, replacement:=k, lookat:=xlPart, MatchCase:=False
End Sub
Last edited: