PC Review


Reply
Thread Tools Rate Thread

Column Coding

 
 
climate
Guest
Posts: n/a
 
      27th Apr 2010
Dear Experts
My data on sheet1 is classified to many groups, any group has special values
on column C and column B. also, any group seprate with 5 blank row than other.
I need to a macro, when run it, write a code under any group at column H
based on numbers or special value of column C and columb B and then add 5000
to it.
Example for first group: special values on column C is 1 and special value
on column B is 10. expected code under column H for this group will be
(1105000).

any help will be appreciating
regards
 
Reply With Quote
 
 
 
 
SteAXA
Guest
Posts: n/a
 
      27th Apr 2010
if i understand right, it's can solve your problem (in excel 2003):

Sub Macro1()
Dim bStop As Boolean
'i start from the cell b1
Range("B1").Select
bStop = False
While Not bStop
'i go down until i find an empty cell
Selection.End(xlDown).Select
'i change the active cell and i move to H cell (independently from
the row)
ActiveCell.Offset(1, 6).Select
'i write my formula text
ActiveCell.FormulaR1C1 =
"=CONCATENATE(R[-1]C[-5],R[-1]C[-6],""5000"")"
'i return on B cell (because i don't know if H cells are compiled)
ActiveCell.Offset(0, -6).Select
'i go down until i find a new compiled cell
Selection.End(xlDown).Select
'if the last cell of the sheet i must stop the routine
If ActiveCell.Value = "" Then
bStop = True
End If
Wend
'i return on the last compiled cell
Selection.End(xlUp).Select
End Sub

Bye
 
Reply With Quote
 
climate
Guest
Posts: n/a
 
      28th Apr 2010
Hi
steAXA, thank you very much , your code is very nice.
joel, thank's for your help , your formula need to copy and paste.

best regards

"SteAXA" wrote:

> if i understand right, it's can solve your problem (in excel 2003):
>
> Sub Macro1()
> Dim bStop As Boolean
> 'i start from the cell b1
> Range("B1").Select
> bStop = False
> While Not bStop
> 'i go down until i find an empty cell
> Selection.End(xlDown).Select
> 'i change the active cell and i move to H cell (independently from
> the row)
> ActiveCell.Offset(1, 6).Select
> 'i write my formula text
> ActiveCell.FormulaR1C1 =
> "=CONCATENATE(R[-1]C[-5],R[-1]C[-6],""5000"")"
> 'i return on B cell (because i don't know if H cells are compiled)
> ActiveCell.Offset(0, -6).Select
> 'i go down until i find a new compiled cell
> Selection.End(xlDown).Select
> 'if the last cell of the sheet i must stop the routine
> If ActiveCell.Value = "" Then
> bStop = True
> End If
> Wend
> 'i return on the last compiled cell
> Selection.End(xlUp).Select
> End Sub
>
> Bye

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
coding text to column =?Utf-8?B?am5ld2w=?= Microsoft Access Form Coding 3 28th Oct 2007 05:54 AM
color coding a stacked column graph cgkang Microsoft Excel Discussion 0 6th Mar 2007 04:17 PM
Color coding column charts =?Utf-8?B?RG9uIFJvdXNl?= Microsoft Excel Programming 0 25th Oct 2005 04:14 AM
Colour coding scatter points from third column Turnipboy Microsoft Excel Discussion 3 29th Sep 2005 06:10 PM
Hard coding column formats Chris Microsoft Excel Misc 1 4th Dec 2003 07:11 PM


Features
 

Advertising
 

Newsgroups
 


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