Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-30-2015, 01:03 AM
Officer_Bierschnitt Officer_Bierschnitt is offline VBA: Find a column by its date Windows 7 64bit VBA: Find a column by its date Office 2013
Advanced Beginner
VBA: Find a column by its date
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default VBA: Find a column by its date

Hi,

I am just learning Excel and VBA again after some years with other tools.
Now I have a task that I have already solved to a good part.
Right now, I have the value I want in a variable and I just have to paste that in the "adressee_table" in a specific row (fixed value depending on the type of value) and a specific column (dependent on the date, the date is across the entire table in line 3).
I always have yesterday's data, so my macro should always look for the column with yesterday's date in line 3 and just paste the variable in that cell.

I guess I need that FIND command, but I don't know the exact syntax and what I have to write in the parameters and I haven't yet got fluent in using the integrated help.
Can anybody tell me how to do that?
Thanks a lot!

Best regards,

Officer_Bierschnitt
Reply With Quote
  #2  
Old 10-31-2015, 02:06 PM
macropod's Avatar
macropod macropod is offline VBA: Find a column by its date Windows 7 64bit VBA: Find a column by its date Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Here's a trivial demonstration of using the Find command to find something in row 3 and return the corresponding value from row 2:
Code:
Sub Demo()
Dim xlRng As Range, StrTxt As String
StrTxt = InputBox("Please input the text to find")
With ActiveSheet
  Set xlRng = .Range("3:3").Find(What:=StrTxt, LookIn:=xlValues, _
    LookAt:=xlWhole, SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False)
  If Not xlRng Is Nothing Then
    MsgBox "Row 3: " & StrTxt & " found in column " & xlRng.Column & vbCr & _
      "Row 2: " & .Cells(2, xlRng.Column).Text & " found in column " & xlRng.Column
  End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which Office program to use to find a day/date gblosser Office 5 01-17-2015 05:44 AM
VBA: Find a column by its date Inconsistent Duration column for the same date ranges ravl13 Project 3 07-28-2014 05:16 PM
VBA: Find a column by its date Automatically enter date into a column and make that column read only Mr Davo Excel 1 10-29-2012 01:07 AM
Displaying Work Week instead of date in a column. whitney07 Project 1 07-05-2012 02:27 PM
VBA: Find a column by its date Use SMALL or LARGE to find date udea Excel 4 05-02-2011 09:08 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft