Fill Up Various Cells

Lauren111111

New Member
Joined
May 1, 2020
Messages
24
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I am trying to Fill Up various cells in a spreadsheet. I have created the macro but it will only work if the cells are in a row, I need this completed for the selection in the whole sheet, is this possible at all?? This will take me forever selecting all the cells applicable with around 300 rows. It says the command cannot be used on multiple sections

Thankyou
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
does your cell selection has any specific criteria?
For manual selection of specific cells, try the following:

VBA Code:
With Selection
    Selection.Value = "Lauren111111"
End With
 
Upvote 0
No unfortunately not. The cells below are what I want copied upwards, these are the same but I cannot work my macro to do this?

e.g
Yellow
Green

Blue
Green

Red
Blue

I want to replace the top values of the values below if they = green. This would then show as

Green
Green

Green
Green

Red
Blue
 
Upvote 0
do you mean if a cell value is green then the value above that cell should be green as well???
If so, what is the frequency of green appearing in the worksheet?

I would suggest providing a sample workbook along with your query using xl2bb addin or dropbox or googledrive.
 
Upvote 0
Yes exactly that. There are many within the worksheet, all over the place. I think I am unable to download as it is a work pc
 
Upvote 0
Yes exactly that. There are many within the worksheet, all over the place. I think I am unable to download as it is a work pc
try
VBA Code:
Sub xyz()
Dim rng As Range
Dim cell As Range

Set rng = ActiveSheet.UsedRange                             'Change the range with reference to your dataset

For Each cell In rng.Cells
    If cell = "Green" Then
        cell.Offset(-1) = cell
    End If
Next cell
End Sub

This will loop through each cell in your used range looking for Green and will change the value of the cell above on each occurrence of Green.

hth....
 
Upvote 0
Solution
[ICODE][/ICODE]You are very welcome.... (y)(y)(y)(y)
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,305
Members
449,079
Latest member
juggernaut24

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