Hi Excel experts,
I have been trying to do this for way to long and it’s got to be a simple syntax so hope you can guide me in the right directions…
What I would like to do is, Find text in a Row get the Column number and then change the properties of that column, snippet below.
This code does what I would like it to,
But I require it in this format,
What am I missing,
Thanks in advance and look forward to any ideas.
I have been trying to do this for way to long and it’s got to be a simple syntax so hope you can guide me in the right directions…
What I would like to do is, Find text in a Row get the Column number and then change the properties of that column, snippet below.
This code does what I would like it to,
Code:
Sub AdjColworking()
Dim ColValue As Long
ColValue = Range(Cells(16, 2), Cells(16, 8)).Find("S. Weight", Range("B16")).Column
Columns(ColValue).NumberFormat = "0.0"
End Sub
But I require it in this format,
Code:
Sub AdjCol()
Dim ColValue As Long
Set ColValue = Range(Cells(16, 2), Cells(16, 8)).Find("S. Weight", Range("B16")).Column
If Not ColValue Is Nothing Then
Columns(ColValue).NumberFormat = "0.0"
End If
End Sub
What am I missing,
- Ideally I would like to use “Find("S. Weight", Range(Cells(16, 2))” not ”Find("S. Weight", Range(Cells(“B16”))” but this isn’t the course of the issue.
Thanks in advance and look forward to any ideas.