Macro to fill cells from data in other cells

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I have a document that has a lot of defalt values for the cells,
now the document keeps changing so the cells keep moving around, and each time i have to go through the macro changing each line from "Range("E11").Value = "Department"" to "Range("E15").Value = "Department""

so ive decided to try do this differently,

Now in Column M i have the column letter i want the Default word in and in column O i have the default word
so for example instead of "Range("E11").Value = "Department"" I have moved the "E" to Cell "M11" and the word "Department" to cell "O11"

So now what i need is a macro to go down column O and for each cell with a word in it put the word into the Cell that is in column M

please help if you can

Thanks

Tony

i'll do a small example here:

Row / ColumnDEFGMNOInstructions
10DepartmentEDepartmentSo the macro goes down Column O,
11Each time it Finds a word,
12StartedDStartedIt puts that word into the column in "M"
13HelpingFHelping
14
15AreaEArea
16Area2FArea2
17
18CatsGCats
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hello,

like this?

VBA Code:
Sub COPY_TO_COLUMN()
    For MY_ROWS = 10 To Range("O" & Rows.Count).End(xlUp).Row
        If Not IsEmpty(Range("O" & MY_ROWS)) Then
            Range(Range("M" & MY_ROWS).Value & MY_ROWS).Value = Range("O" & MY_ROWS).Value
        End If
    Next MY_ROWS
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

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