VBA code through excel

lookforsmt

New Member
Joined
Jan 31, 2014
Messages
3
I have a excel sheet1:

Where in cell A1 there is a number which can be -ve or +ve number

I have Fixed value in cell A10 which is text and B10 is number and
another Fixed value in cell A11 which is text and B11 is number

My question is through vba code i want to check the value in cell A1, if it is +ve, then place the value of A10 & B10 in cell B1 & C1 respectively and similiarly place the value of A11 & B11 in cell B2 & C2 resepectively and
vice versa when the value is -ve.
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

francoisdublin

New Member
Joined
Jan 23, 2014
Messages
32
Hey, this code would work. In fact you could remove this bit [ElseIf Range("a1").Value < 0 Then] and replace it with [Else]





If Range("a1").Value > 0 Then
Range("B1:C1").Value = Range("A10:B10").Value
ElseIf Range("a1").Value < 0 Then Range("B1:C1").Value = Range("A11:B11").Value
End If
 

lookforsmt

New Member
Joined
Jan 31, 2014
Messages
3
Hey, this code would work. In fact you could remove this bit [ElseIf Range("a1").Value < 0 Then] and replace it with [Else]

hi! thanks for the code provided, I have put the code, but it does not seem to do anything. Is their a button that I need to run the code inorder to work or it displays by itself the movement it meets the crietria

regardsd
 

lookforsmt

New Member
Joined
Jan 31, 2014
Messages
3
hi! thanks for the code provided, I have put the code, but it does not seem to do anything. Is their a button that I need to run the code inorder to work or it displays by itself the movement it meets the crietria

regardsd

hi
pls can any one reply to my request. I question may be real stupid but it will do a great help for me

Thanks for understanding
 

Watch MrExcel Video

Forum statistics

Threads
1,123,307
Messages
5,600,869
Members
414,411
Latest member
Snowmanaus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top