Inserting values to specified range

Yokiboha

Board Regular
Joined
Feb 21, 2007
Messages
207
I am sure this is quite simple but is escaping me

In cells S5 and S6 I have two cell references which will change each time I filter.

I wish to insert a value ("w") in this range each time the macro runs.

Can anybody help please?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Is this what you are looking for?
Code:
Range("S5:S6")="w"
If not, you are going to need to explain your issue in a bit more detail.
 
Upvote 0
Is this what you are looking for?
Code:
Range("S5:S6")="w"
If not, you are going to need to explain your issue in a bit more detail.

Thank you Joe4.

I probably didn't make it clear. The cells S5 and S6 contain references to other cells, e.g. S5 contains the reference to cell Q33, S6 contains the reference to cell C53, and it is these cells in column Q that I need to fill with "w".

So in the code I need to pick up the values in the cells S5 and S6

Can it be done?
 
Upvote 0
Here is one way:
Code:
    Dim rng1 As Range, rng2 As Range
    
    Set rng1 = Range(Range("S5").Value)
    Set rng2 = Range(Range("S6").Value)
    
    rng1 = "w"
    rng2 = "w"
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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