apatriarca87
New Member
- Joined
- Sep 6, 2013
- Messages
- 9
Hi,
I'm a beginner to excel and I'm creating a macro that will move values to column B and AI. Here's the scenario I have to check each row and with each row either have two columns that have values or one columns with values the values can either be in any ranges of columns. I know I need to loop each row after I move the values i need.
If row = 1 column with values then
move value to same row column C.
If row = 2 columns with values then
move value furthest to the right
to same row column AI.
Sub MoveValue()
Dim val1 as string
Dim val2 as string
Dim workrange as Range
Set r = Sheets("Sheet1").UsedRange
For r = 1 to workrange
If row = 1 column with values then
move value to same row column C.
If row = 2 columns with values then
move value furthest to the right
to same row column AI.
next r
End Sub
I'm a beginner to excel and I'm creating a macro that will move values to column B and AI. Here's the scenario I have to check each row and with each row either have two columns that have values or one columns with values the values can either be in any ranges of columns. I know I need to loop each row after I move the values i need.
If row = 1 column with values then
move value to same row column C.
If row = 2 columns with values then
move value furthest to the right
to same row column AI.
Sub MoveValue()
Dim val1 as string
Dim val2 as string
Dim workrange as Range
Set r = Sheets("Sheet1").UsedRange
For r = 1 to workrange
If row = 1 column with values then
move value to same row column C.
If row = 2 columns with values then
move value furthest to the right
to same row column AI.
next r
End Sub