troubleshooting Question

how to fix this VBA code

Avatar of Flora Edwards
Flora EdwardsFlag for Sweden asked on
VBA
3 Comments1 Solution73 ViewsLast Modified:
i am trying to put this in array of cells but it overwrites other values

i want the objQuickFix headers to appear in Columns

like this Computer:   "Description: " "Hot Fix ID: "  as header of columns and then the data to put in rows.

i tried the below code but it overwrites the previous data and it is a mess.

 Sub Test()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colQuickFixes = objWMIService.ExecQuery _
    ("Select * from Win32_QuickFixEngineering")
 
For Each objQuickFix In colQuickFixes
    Cells(1, 1).Value = "Computer: "
    Cells(2, 1).Value = objQuickFix.CSName
    Cells(1, 2).Value = "Description: "
    Cells(2, 2).Value = objQuickFix.Description
    Cells(2, 3).Value = "Hot Fix ID: "
    Cells(3, 3).Value = objQuickFix.HotFixID
    Cells(3, 4).Value = "Installation Date: "
    Cells(4, 4).Value = objQuickFix.InstallDate
    Cells(4, 5).Value = "Installed By: "
    Cells(5, 5).Value = objQuickFix.InstalledBy
Next
End Sub
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros