Not sure if this is possible, but a Vlookup / plot

chally3

Board Regular
Joined
Mar 22, 2006
Messages
157
Hi all, I'm note sure if this at all possible in excel but I'll give it a go.
I have a table of data (Columns A-T) that updates daily and columns U-EC are all date fields (the start of each working week ie mondays)

In the spreadsheet column T has a date in each row. Each row is a different part.

What I would like to know is , can the value that appears in say "T2" be plotted in the column that that date falls into (columns U-EC )

ie cell T2 is data "20/06/19" , look across the next columns and put an "X" or copy the date into the column the working week it falls in for that row.

Appreciate there must be an easier way of doing this, but its the only way i can explain what I need.

Thank you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try:
Code:
Sub chally()
    Application.ScreenUpdating = False
    Dim LastRow As Long, strdate As String, foundDate As Range, rng As Range
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rng In Range("T2:T" And LastRow)
        strdate = rng
        Set foundDate = Rows(1).Find(CDate(strdate), LookIn:=xlFormulas, lookat:=xlWhole)
        If Not foundDate Is Nothing Then
            Cells(rng.Row, foundDate.Column) = "X"
        End If
    Next rng
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks, I just added this and keep getting runtime error 13 (worksheet is sheet 2 if thats any help)
 
Upvote 0
Which line of code is highlighted when you click "Debug"?
 
Upvote 0
I was looking for that, and strangely none!, I just get the error Run-time "13": type miss-match
 
Upvote 0
Give this a try:
Code:
Sub chally()
    Application.ScreenUpdating = False
    Dim LastRow As Long, strdate As String, foundDate As Range, rng As Range
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rng In Range("T2:T" And LastRow)
        strdate = CStr(rng)
        Set foundDate = Rows(1).Find(CDate(strdate), LookIn:=xlFormulas, lookat:=xlWhole)
        If Not foundDate Is Nothing Then
            Cells(rng.Row, foundDate.Column) = "X"
        End If
    Next rng
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hiya,

Just getting a "type mismatch' error warning only.


Thank you for your help by the way :)

kind regards
Mark
 
Upvote 0
I think that it would be easier to help and test possible solutions if I could work with your actual file which includes any macros you are currently using. Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0
I think that it would be easier to help and test possible solutions if I could work with your actual file which includes any macros you are currently using. Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.

will do later, thank you for your help.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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