Wednesday, July 6, 2016

Fast Solution to Problem: Assining a Long Variable a value as a result of Find Method

Assining a Long Variable a value as a result of Find Method

Hi
 
Trying to right VBA code to find a given header in my second sheet, then fill in cells of a given range in my first sheet with the number of the column that the searched header is in.
 
The end result will be using a WorksheetFunction Vlookup to retrieve the appropriate data, but that implicates getting the column number first so this is more of a failsafe test I'm trying to pull:
 
 
Got following code so far, not working...:
 
                With Range("I2:I" & MyFirstSheetRowCount)
                    Dim c As Range
                    Set c = Sheets("MySecondSheet").Range("A2", Range("A2").End(xlToRight)).Find("MySearchString", , xlValues, xlWhole).Address
                    .FormulaR1C1 = c.Column
                End With
 
Any thoughts?
 
Ps.
The searched range I'm using the Find Method on is correct since 1:1 row is blank on my second sheet per definition.
 
Thanks

Solutions to the Problem Assining a Long Variable a value as a result of Find Method

Download SmartPCFixer for Free Now

c is a range, so you don't use .Address on the "set c" line....
 
Try:
 
Dim c As Range
Set c = Sheets("MySecondSheet").Range("2:2:).Find("MySearchString", , xlValues, xlWhole)
Range("I2:I" & MyFirstSheetRowCount).Value = c.Column
 
 
PS  When you are working with different sheets and ranges and end(xl...)ing, you need to be very precise about your ranges:
 
Set c = Sheets("MySecondSheet").Range("A2", Range("A2").End(xlToRight)).Find("MySearchString", , xlValues, xlWhole)
 
would need to be
 
Set c = Sheets("MySecondSheet").Range(Sheets("MySecondSheet").Range("A2"), Sheets("MySecondSheet").Range("A2").End(xlToRight)).Find("MySearchString", , xlValues, xlWhole)

Running System Update Readiness Command

On running the System Update readiness Command, it will Detect & Replace Incorrect Registry data with the Correct one. Which may ultimately Solve Assining a Long Variable a value as a result of Find Method in Windows.

  1. Open CMD as Administrator by Simply Right Clicking on Start button > Command Prompt (Admin).
  2. Now Type or Copy paste "DISM.exe /Online /Cleanup-image /Scanhealth" and hit Enter,
  3. Now again Type or Copy paste this "DISM.exe /Online /Cleanup-image /Restorehealth" and hit Enter.
  4. Close the Command Prompt Window because we are done.

Try and see if you still get the same error Assining a Long Variable a value as a result of Find Method in your Windows.

Note: You may be prompted to enter your administrator's password when you try to execute certain system tasks!

Another Safe way to Repair the Problem: Assining a Long Variable a value as a result of Find Method:

How to Fix Assining a Long Variable a value as a result of Find Method with SmartPCFixer?

1. Click the button to download SmartPCFixer . Install it on your system.  Run it, and it will scan your computer. The errors will be shown in the scan result.

2. After the scan is done, you can see the errors and problems which need to be repaired.

3. The Repair part is done, the speed of your computer will be much higher than before and the errors have been removed. You can also use other functions in this software. Like dll downloading, junk file cleaning and print spooler error repair.


Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: How to Fix - Automatic Update turned off. How to remove JS\/Proslikefan.gen!inf.?,How Can You Fix - Automatically signing in to MSN??,[Solved] Background Colour for Workseet,Backup utility backing up folders it shouldn't ??? [Anwsered],How to Resolve - backup error 0x80070002 could not find files specified?,application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?

No comments:

Post a Comment