#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default Macro help

I have a macro I created that looks at 4 columns that contain text in each,
as follows:
DK - A
DL - SK
DM - CU
DN - SPEC

In column DP, the macro should indicate "multi" if two or more are in
columns DK: DN. If only one is in all four than place the text, either "A",
"SK", "CU" OR "SPEC"

My macro is currently placing "multi" if one is indicated and if two or more
it is concenating the four columns in DN.. Example: ACU or CUSPEC OR SKCUSPEC

Can someone look at this macro and let me now what is wrong? Thank you


Select Case WorksheetFunction.CountBlank(Range("DK" & X & ":DN" & X))
Case 2
Cells(X, 120) = Cells(X, 115) & Cells(X, 116) & Cells(X, 117) &
Cells(X, 118)

Case Else
Cells(X, 120) = "Multi"
End Select
On Error Resume Next

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Macro help

Hi,

You don't appear to checking what values are in your cells just that there
are values so how about this approach

If WorksheetFunction.CountA(Range("DK" & x & ":DN" & x)) 1 Then
Cells(x, 120) = "Multi"
Else
Cells(x, 120) = WorksheetFunction.Lookup(WorksheetFunction.Rept("z ",
99), Range("DK" & x & ":DN" & x))
End If

Mike

"Jen_T" wrote:

I have a macro I created that looks at 4 columns that contain text in each,
as follows:
DK - A
DL - SK
DM - CU
DN - SPEC

In column DP, the macro should indicate "multi" if two or more are in
columns DK: DN. If only one is in all four than place the text, either "A",
"SK", "CU" OR "SPEC"

My macro is currently placing "multi" if one is indicated and if two or more
it is concenating the four columns in DN.. Example: ACU or CUSPEC OR SKCUSPEC

Can someone look at this macro and let me now what is wrong? Thank you


Select Case WorksheetFunction.CountBlank(Range("DK" & X & ":DN" & X))
Case 2
Cells(X, 120) = Cells(X, 115) & Cells(X, 116) & Cells(X, 117) &
Cells(X, 118)

Case Else
Cells(X, 120) = "Multi"
End Select
On Error Resume Next

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM


All times are GMT +1. The time now is 07:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"