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.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,337
Members
448,568
Latest member
Honeymonster123

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
Back
Top