Solved

VBA Excel - Error checking cell value on cells containing TRANSPOSE forumla

Posted on 2013-01-17
1
551 Views
Last Modified: 2013-01-19
Hi,

I have a range of cells that I need to check if they are empty or 0.

The cells contain a formula "=TRANSPOSE(''A2:JK8)"

As a result, any time I try to check the cell value or modify the cell value I seem to get "type mismatch" errors.

If Range("A2:JK8").value = "" Then

Open in new window


Can anybody help me get around this?

I attempted to convert the cell to a value (and remove the formula) but I got an error "cannot change part of an array".
Range("A2:JK8").value = Range("A2:JK8").value

Open in new window


Thankyou
0
Comment
Question by:mhdi
1 Comment
 
LVL 24

Accepted Solution

by:
Steve earned 500 total points
ID: 38791966
Which cells contain the TRANSPOSE formula, it will not just be one cell but an array of cells.

You need to work with the array of cells holding transpose formula.

Simple Example workbook attached.

To change the cells to values use:

Sheets("Sheet2").Range("B2:H283").value = Sheets("Sheet2").Range("B2:H283").value

Open in new window

Transpose-VBA-Example.xlsm
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

22 Experts available now in Live!

Get 1:1 Help Now