I am trying to create something that is capable of taking the value from one text box, searching a group of column headers to find the correct one, and then placing a new value from a second text box into the last row under that column. I adapted this code that I found on here, https://stackoverflow.com/a/37687346/13073514, but I need some help. This code posts the value from the second text box under every header, and I would like it to only post it under the header that is found in textbox 1. Can anyone help me and explain how I can make this work? I am new to vba, so any explanations would be greatly appreciated.
Public Sub FindAndConvert() Dim i As Integer Dim lastRow As Long Dim myRng As Range Dim mycell As Range Dim MyColl As Collection Dim myIterator As Variant Set MyColl = New Collection MyColl.Add "Craig" MyColl.Add "Ed" lastRow = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row For i = 1 To 25 For Each myIterator In MyColl If Cells(1, i) = myIterator Then Set myRng = Range(Cells(2, i), Cells(lastRow, i)) For Each mycell In myRng mycell.Value = Val(mycell.Value) Next End If Next Next