Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
thom hoyle
 
Posts: n/a
Default add "X" to cell based on cell value

I don't know how to accomplish this task:
While staying in a single column, I would like to enter a value like 12 and
have it autofill eleven "x"s below the twelve indicating 12 rows including
the value entered totals 12.. make sense?
this needs to happen anyplace a value is entered in the column, that the
number of "x"s need to fill in below less one.

Row A

5
x - Autofills based on value above less that cell.
x
x
x
3 - Same here and down the column
x
x
4 - same
x
x
x

Thanks in advance.. I have read several CountIf .. Data Validation .. just
don't know how to start..

thanks
thom


  #2   Report Post  
JulieD
 
Posts: n/a
Default

Hi Thom

you'll need code to do this - here's code that works on column A
---

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo err_handler
If Target.Column = 1 Then
If IsNumeric(Target.Value) Then
For i = 1 To Target.Value - 1
Target.Offset(i, 0) = "x"
Next
End If
End If

err_handler:
Application.EnableEvents = True
End Sub
---
to use it, right mouse click on the sheet tab of the sheet you want to use
the code in, choose view code
copy & paste the code into the right hand side of the screen
use alt & f11 to switch back to your worksheet
type a number in column A and see what happens
NOTE there is no checking to ensure that data is not in the cells where the
X will go, so maybe do this on a copy of the workbook first.

Cheers
JulieD

"thom hoyle" wrote in message
...
I don't know how to accomplish this task:
While staying in a single column, I would like to enter a value like 12
and
have it autofill eleven "x"s below the twelve indicating 12 rows including
the value entered totals 12.. make sense?
this needs to happen anyplace a value is entered in the column, that the
number of "x"s need to fill in below less one.

Row A

5
x - Autofills based on value above less that cell.
x
x
x
3 - Same here and down the column
x
x
4 - same
x
x
x

Thanks in advance.. I have read several CountIf .. Data Validation .. just
don't know how to start..

thanks
thom




  #3   Report Post  
thom hoyle
 
Posts: n/a
Default

That was Great Julie.. thanks..
I would like to take it one more step... How do I target a Range in a column
for this.. specifically I need this in H:15;H:204

thanks

"JulieD" wrote:

Hi Thom

you'll need code to do this - here's code that works on column A
---

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo err_handler
If Target.Column = 1 Then
If IsNumeric(Target.Value) Then
For i = 1 To Target.Value - 1
Target.Offset(i, 0) = "x"
Next
End If
End If

err_handler:
Application.EnableEvents = True
End Sub
---
to use it, right mouse click on the sheet tab of the sheet you want to use
the code in, choose view code
copy & paste the code into the right hand side of the screen
use alt & f11 to switch back to your worksheet
type a number in column A and see what happens
NOTE there is no checking to ensure that data is not in the cells where the
X will go, so maybe do this on a copy of the workbook first.

Cheers
JulieD

"thom hoyle" wrote in message
...
I don't know how to accomplish this task:
While staying in a single column, I would like to enter a value like 12
and
have it autofill eleven "x"s below the twelve indicating 12 rows including
the value entered totals 12.. make sense?
this needs to happen anyplace a value is entered in the column, that the
number of "x"s need to fill in below less one.

Row A

5
x - Autofills based on value above less that cell.
x
x
x
3 - Same here and down the column
x
x
4 - same
x
x
x

Thanks in advance.. I have read several CountIf .. Data Validation .. just
don't know how to start..

thanks
thom





  #4   Report Post  
JulieD
 
Posts: n/a
Default

Hi Thom

change the code to the following
---
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo err_handler
If Intersect(Range("H15:H204"), Target) And IsNumeric(Target.Value)
Then
For i = 1 To Target.Value - 1
Target.Offset(i, 0) = "x"
Next
End If

err_handler:
Application.EnableEvents = True
End Sub
--

note, depending on your regional settings you may need to change H15:H204 or
H15;H204

Cheers
JulieD

"thom hoyle" wrote in message
...
That was Great Julie.. thanks..
I would like to take it one more step... How do I target a Range in a
column
for this.. specifically I need this in H:15;H:204

thanks

"JulieD" wrote:

Hi Thom

you'll need code to do this - here's code that works on column A
---

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo err_handler
If Target.Column = 1 Then
If IsNumeric(Target.Value) Then
For i = 1 To Target.Value - 1
Target.Offset(i, 0) = "x"
Next
End If
End If

err_handler:
Application.EnableEvents = True
End Sub
---
to use it, right mouse click on the sheet tab of the sheet you want to
use
the code in, choose view code
copy & paste the code into the right hand side of the screen
use alt & f11 to switch back to your worksheet
type a number in column A and see what happens
NOTE there is no checking to ensure that data is not in the cells where
the
X will go, so maybe do this on a copy of the workbook first.

Cheers
JulieD

"thom hoyle" wrote in message
...
I don't know how to accomplish this task:
While staying in a single column, I would like to enter a value like 12
and
have it autofill eleven "x"s below the twelve indicating 12 rows
including
the value entered totals 12.. make sense?
this needs to happen anyplace a value is entered in the column, that
the
number of "x"s need to fill in below less one.

Row A

5
x - Autofills based on value above less that cell.
x
x
x
3 - Same here and down the column
x
x
4 - same
x
x
x

Thanks in advance.. I have read several CountIf .. Data Validation ..
just
don't know how to start..

thanks
thom







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
Find Max and Min based on cell reference gregork Excel Discussion (Misc queries) 3 February 21st 05 12:28 AM
I want to return "0" based on another cell CM Excel Worksheet Functions 2 February 17th 05 02:46 PM
make a cell empty based on condition mpierre Charts and Charting in Excel 2 December 29th 04 01:01 PM
I am trying to link based on a text value instead of cell position John Links and Linking in Excel 3 December 3rd 04 06:29 PM
How to populate column with formula based on value in cell Cameron Stewart Excel Worksheet Functions 2 November 2nd 04 01:36 AM


All times are GMT +1. The time now is 04:04 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"