pwill

Active Member
Joined
Nov 22, 2015
Messages
406
Hi can any help with a formula to highlight text within a range that is equal to todays date

eg Range H4:N9

todays date is 28th Jan so the value in cell N8 (28) is auto highlighted in red

M
TWTFSS
1234567
891011121314
15161718192021
22232425262728
293031



<colgroup><col style="mso-width-source:userset;mso-width-alt:1097; width:23pt" span="7" width="30"> </colgroup><tbody>
</tbody>
any help would be apprieciated

regards

pwill
 
Not sure what your wanting help with.
But if all your wanting is to put zeros in column A to G of the lastrow+1 you can use this:
You need no loop.

Code:
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range(Cells(Lastrow, "A"), Cells(Lastrow, "G")).Value = "0"
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
If you insist and want a loop it would be like this:

Code:
Sub I_Want_A_Loop()
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
    For i = 1 To 7
        Cells(Lastrow, i).Value = "0"
    Next
End Sub
 
Upvote 0
If you want to enter all this years dates in column (A) and in column (B) put the dates day.

Try this script:

Code:
Sub Enter_Dates_Column_A()
Dim i As Long
    For i = 1 To 365
    
    Cells(i, 1).Value = DateAdd("d", i - 1, "1/1/2018")
    Cells(i, 2).Value = Day(Cells(i, 1))
    
Next
End Sub
 
Upvote 0
Hi My Aswer Is This,

Sorry if I have confused things, it would be so much easier if I could upload a workbook example.

Basically it's the Auto fill I am struggling with. I add rows of data A2:G sheet1 this could be any amount of rows. Then the macro adds the zero's for me to the last empty rows A:Gand the 1's in column H These rows are then copied to sheet2 over writing the last rows in columns E:L Columns A and D sheet2 already have dates and count pre set.
Then on then sheet2 AI:AQ are linked to columns A, D & E:K sheet2 to duplicate the data in these column when dragging down. when I drag down from the last rows in columns AI:AQ I want to Auto fill the amount of rows copied from sheet1. So if 10 rows where added from sheet1 the auto fill in AI:AQ would fill down 10 rows from the last row in AI:AQ.

Does this make more sense? It's long winded I know but if I could upload a workbook example you would think it is really very simple.

Hope this helps?

Regards

pwill
 
Upvote 0
Sorry I just noticed the sheets where numbered wrong in the macro I gave, they should have been

Dim wsUpdates As Worksheet: Set wsUpdates = Sheet01 Dim wsData As Worksheet: Set wsData = Sheet02

sorry about that

pwill
 
Last edited:
Upvote 0
I'm sorry but this is more complicated then I thought. I thought you were just learning Vba and wanting help creating a loop. And I'm not familiar with "AutoFill".
I did notice in a earlier post you were wanting to renumber your sheets also. So I'm not familiar with how you can have a sheet numbered Sheet00. You could name a sheet "Sheet00" but how you can number a sheet as 00 is also something I'm not familiar with.
Please excuse my ignorance on these issues. I'm hoping someone else here at Mr. Excel will be able to help you. I will continue to monitor this thread to see what I can learn.
 
Upvote 0
I did look into Autofill and suppose the reason you are using this is because you have formulas in these cells.
 
Upvote 0
Hi, yes that's exactly right, the formulas in these cells arrange the data the way I want it when I auto fill down.

Your help is always appreciated.

Regards
 
Upvote 0
I assume you know a lot of times if your using Vba instead of putting formulas in cells you can have Vba put the results of a formulas into a cell and really need no formula in the cell.

Cells(1,3).value=Cells(1,1).value+Cells(1,2).value
And put that into a loop.
 
Upvote 0
Hi, thanks My Aswer Is This,

Yes I know you can do that sort thing with Vba, I probably will when I get things to how I want them. Just so you know I wouldn't say i'm a newby but I am still learning, I pretty much know the basics but compared to others on here I am just scratching the surface. Sorry about any confusion with my posts, I will keep trying to find the answer I am looking for and if I do I will let you know what the solution turns out to be.

As for re numbering my sheets, you probably already know how to, its just me complicating things but I will explain anyway.

In the Visual Basic window on the left where the project window is, if you click view properties window you can change the name of the sheet, all I did was add a '0' before the 1 ie sheet1 to sheet01 and I did the same with another sheet but changed it to 'sheet00' then when you look at the project window you will see the sheet name has changed to Sheet01(Tab Name) but i'm sure you already knew that lol

Regards

pwill
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,667
Members
449,462
Latest member
Chislobog

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