Strings n things

ExcelEddie

New Member
Joined
Feb 18, 2013
Messages
22
Hi all,

I hope this is possible...

I have a formula that loads a text string to a cell
The formula is a VLOOKUP (See below - nothing special)
The text string shows in the cell that contains the formula but only to the pre-determined boundary of the cell
So far, so good

Is VBA clever enough to expand the cell vertically to include the text string found by the formula?

Formula:
=IF(VLOOKUP($C$4,DB!$A:$QD,50,FALSE)="","",VLOOKUP($C$4,DB!$A:$QD,50,FALSE))

Thank you in advance
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Is VBA clever enough to expand the cell vertically to include the text string found by the formula?
Not really sure what you mean.
Can you walk us through an example?
 
Upvote 0
Thanks guys so let's just say that...

A VLOOKUP formula in cell A1 has found and shown a text string in cell A1
The text string is too long to show itself in cell A1 and only shows a few words

Can VBA code resize cell A1 so that I can see the full string, without removing the original VLOOKUP formula.

Image 1 shows the formula that searches for and shows the text string in image 2
The text string is much longer than shown in image 2

Hope that helps

Eddie
 

Attachments

  • image1.JPG
    image1.JPG
    14.5 KB · Views: 8
  • image2.JPG
    image2.JPG
    20.7 KB · Views: 8
Upvote 0
Not really sure what you mean.
Can you walk us through an example?
I have tried using Range("A1").EntireRow.AutoFit but this does not want to resize the cell, I think this is due to the cell actually holding a formula and not the text that was loaded via the formula.
 
Upvote 0
If you want to AutoFit the column, you need to use "EntireColumn", not "EntireRow", i.e.
VBA Code:
Range("A1").EntireColumn.AutoFit
 
Upvote 0
If you want to AutoFit the column, you need to use "EntireColumn", not "EntireRow", i.e.
VBA Code:
Range("A1").EntireColumn.AutoFit
Yeah, got that thanks however... this widens the cell in question, and this is not an option I really need to the cell's height to change and not the width.

If this is not possible then so be it :(

Thank you for you your time Joe
 
Upvote 0
If you want the height to be changed Range("A1").EntireRow.AutoFit if you want the width to be changed Range("A1").EntireColumn.AutoFit
 
Upvote 0
Do you have the cells set to wrap the text (I think you need this if you want the height to be adjusted automatically)?
Do you have any merged cells on your sheet?
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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