Solved

VBA Code correction to combine three tasks

Posted on 2011-09-06
6
246 Views
Last Modified: 2012-05-12
Dear Experts,
recently I asked three questions which were all solved with vba code and each solution works fine. Now I need to combine all three solution into one but my coding experience is not good enough.
See here:
http://www.experts-exchange.com/Microsoft/Applications/Q_27286592.html
http://www.experts-exchange.com/Microsoft/Applications/Q_27288516.html
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27159284.html

The code below is almost working :-)
1. The tracking does not fix the previous value only the new one in the new line
2. I want to secure the history sheet with a password to prevent any changes from users. At the same time code must work and be able to write values to that sheet..

thanks
Nils




Private Sub Worksheet_Change(ByVal Target As Range)
Dim vOld
Dim rng As Range
Set rng = Range("A5:AA100")

    If Not Intersect(Target, rng) Is Nothing Then
    Debug.Print (Target.Column)
        Target.Offset(0, 29 - Target.Column).Value = Now()
        Target.Offset(0, 30 - Target.Column).Value = Environ("UserName")
    vOld = Target
    End If

With Sheets("Tracking").Range("A" & Rows.Count).End(xlUp)(2)
    .Value = Now
    .Offset(, 1).Value = Environ("username")
    .Offset(, 2).Value = Target.Address
    .Offset(, 3).Value = vOld
    .Offset(, 4).Value = Target
End With

End Sub


Private Sub Workbook_Open()
    Sheets("Tracking").Protect Password:="123456", DrawingObjects:=True, _
        contents:=True, Scenarios:=True, _
        userinterfaceonly:=True
    Sheets("COA-Matrix")EnableAutoFilter = True
End Sub


0
Comment
Question by:Petersburg1
  • 3
  • 3
6 Comments
 
LVL 29

Accepted Solution

by:
gowflow earned 250 total points
Comment Utility
replace this
Sheets("COA-Matrix")EnableAutoFilter = True
by this
Sheets("COA-Matrix").EnableAutoFilter = True

Your missing the point "." before EnableAutoFilter

What else is not working ?
gowflow
0
 

Author Comment

by:Petersburg1
Comment Utility
I want to use  the the same code for 3 excel files which are located in three different folders, however when I adapt the ranges in the excel files the code for all excel files is changes?
The code is currently saved in "sheet1". Looks like I do not know the architecture of where to save..
thanks for advise.
Where to save so I can adapt ranges and save together with each excel file?
thanks
0
 
LVL 29

Expert Comment

by:gowflow
Comment Utility
You can save them in a module but then it depends how they are called. Can't you post them I will fix it for you ? easier for both of us
gowflow
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Petersburg1
Comment Utility
looks like I have fixed it.
thanks for help anyway
0
 

Author Closing Comment

by:Petersburg1
Comment Utility
thanks
0
 
LVL 29

Expert Comment

by:gowflow
Comment Utility
tks for the grade
gowflow
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now