seattletimebandit
Board Regular
- Joined
- Apr 11, 2013
- Messages
- 69
Hello!
I have a bit of code that manipulates data starting in a specific cell. Trying to figure out how to do this by asking the user to select the range, not matter where the table of data is located. The code I have now:
Before code:
[TABLE="class: grid, width: 370"]
<tbody>[TR]
[TD="width: 74"][/TD]
[TD="width: 74"]Text-1[/TD]
[TD="width: 74"]Text-2[/TD]
[TD="width: 74"]Text-3[/TD]
[TD="width: 74"]Text-4[/TD]
[TD="width: 74"]Text-5[/TD]
[/TR]
</tbody>[/TABLE]
After code:
[TABLE="class: grid, width: 370"]
<tbody>[TR]
[TD]Text[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
I'm working on it, and have the Msg Box bit for selecting the range, but not sure how to run the macro on the selection. There would only be 1 row, but number of columns is variable.
Thanks!
Russell
I have a bit of code that manipulates data starting in a specific cell. Trying to figure out how to do this by asking the user to select the range, not matter where the table of data is located. The code I have now:
Code:
Sub SplitDepthsFromSampleID()
Dim ID As String
ID = Left(Range("B1").Value, InStrRev(Range("B1").Value, "-") - 1)
Range("A1").Value = ID
Range("B1", Cells(1, Columns.Count).End(xlToLeft)).Replace ID & "-", "", xlPart, , , , False
End Sub
Before code:
[TABLE="class: grid, width: 370"]
<tbody>[TR]
[TD="width: 74"][/TD]
[TD="width: 74"]Text-1[/TD]
[TD="width: 74"]Text-2[/TD]
[TD="width: 74"]Text-3[/TD]
[TD="width: 74"]Text-4[/TD]
[TD="width: 74"]Text-5[/TD]
[/TR]
</tbody>[/TABLE]
After code:
[TABLE="class: grid, width: 370"]
<tbody>[TR]
[TD]Text[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
I'm working on it, and have the Msg Box bit for selecting the range, but not sure how to run the macro on the selection. There would only be 1 row, but number of columns is variable.
Thanks!
Russell