ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign a data type to specific cells based on IF stmt... (https://www.excelbanter.com/excel-programming/273225-re-assign-data-type-specific-cells-based-if-stmt.html)

Michael J. Malinsky

Assign a data type to specific cells based on IF stmt...
 
I think this is what you want:

R = 2
Do While Not (IsEmpty(Cells(R, 6)))
If Not IsEmpty(Cells(R, 1)) And Not IsEmpty(Cells(R, 3)) And
IsEmpty(Cells(R, 2)) Then
Cells(R, 2).Value = "XXXXX"
End If
R = R + 1
Loop

HTH

--
Michael J. Malinsky


"Chris Powell" wrote in message
...
I import data into my worksheet from another Excel file and after the
import is complete, each cell in col B is assigned the type "text"
(confirmed using TYPE function). In the event that no value is found in
a particular row in Col B., the TYPE function indicates that it's type
"number".

I want to place a string "XXXXXXXXXX" in all rows where col. B is empty
AND where Cols. A and C have a value. I want to use the following simple
IF condition:

R = 2
Do While Not (IsEmpty(Cells(R, 6)))
If Not IsEmpty((Cells(R, 1)) And (Cells(R, 3))) And IsEmpty(Cells(R, 2))
Then
' code needed here!
End If
R = R + 1
Loop

When I try to assign a value and run the code, I get a type mismatch
error code 13. How can I either: (a) reassign the data type to text in
any cell where Col. A and C have a value AND Col B is empty or (b)
simply reassign the data type for all cells in Col B to text? This way,
I can put a "XXXXXXXXXX" string in the desired cells...

Thanks much in advance! Chris

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Chris Powell[_2_]

Assign a data type to specific cells based on IF stmt...
 




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com