Excel 2010 Macro

rickjoey

New Member
Joined
Jan 29, 2014
Messages
1
I have a few questions regarding macros and importing data to another office app.

1st question: Is there a way to move info from one cell to another, based on whether the info in 2 other cells match?

2nd question: I then want to transfer some of the data from several other cell into a word document.

3rd question: Some of the cells font colors have changed due to another macro I am using to sort some of the columns. How can I change the color back to default(black)?

Thanks!
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
Hi, and welcome to the board.
Question 1. It depends on what you mean by "move info from one cell to another".
The below example will look at the values in cells A1 & B1. If they are equal, then it will make the value of C1 the same as the value in D1.
Code:
If Range("A1") = Range("B1") Then Range("D1").Value = Range("C1").Value
(If you wanted C1 to be blank when finished, you could add to it like so.
Code:
If Range("A1") = Range("B1") Then Range("D1").Value = Range("C1").Value: Range("C1") = ""

Question 2. I don't transfer data from Excel to Word often (perhaps once a month or so) but when I do, I simply copy it from Excel and use Paste Special (as unformatted text) into Word. I don't know if that's going to help you or not.

Question 3. I assume you mean doing this using vba. (yes?) If so, then I also assume you know the range to refer to?
If the range(s) are known, then something like this should do it.
Code:
Range("YourSpecifiedRange").Font.ColorIndex = xlAutomatic
That will change the font color of your specified range to whatever color has been assigned as the 'normal' color in your excel. If you want it to always go to black, (regardless of what's been assigned as the 'normal' color), use a zero instead of xlAutomatic.
Further, if you simply want all fonts throughout the worksheet to be black, then you don't need to know (or specify) the range. You can just use:
Code:
Cells.Font.ColorIndex = xlAutomatic

Does any of that help?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,214
Messages
5,594,882
Members
413,947
Latest member
gizmolucy

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