Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #110457

Re: Enter value in compute cell location?

Newsgroups microsoft.public.excel.programming
Date 2018-01-24 03:34 -0800
References <p3lu7i$btb$1@gioia.aioe.org>
Message-ID <991648fb-e40b-4391-804e-e8ca7755e9d1@googlegroups.com> (permalink)
Subject Re: Enter value in compute cell location?
From Gerry Timber <swa2194@gmail.com>

Show all headers | View raw


Perhaps this Sub might be of a little help, aswell as the 'call' in front of the called sub appears not to be mandatory.

This macro does the trick as per your request:
What it performs is by 2 absolute cellreferences controling initial row and column numbering.

a few dims and a for next loop do the dirty work

have fun.



Option Explicit

Sub SplitValCol()
Dim colCount As Integer
Dim rowcount As Integer
Dim celVal As Range
Dim amt As Integer
Dim rownr As Long
ActiveCell.SpecialCells(xlLastCell).Select
rownr = ActiveCell.Row
Range("A1").Select

colCount = 2
rowcount = 2

For rowcount = 2 To rownr

If Cells(rowcount, colCount) = "a" Then
amt = Cells(rowcount, colCount - 1)
Cells(rowcount, colCount + 2) = amt

Else

If Cells(rowcount, colCount) = "b" Then
amt = Cells(rowcount, colCount - 1)
Cells(rowcount, colCount + 3) = amt

Else

If Cells(rowcount, colCount) = "c" Then
amt = Cells(rowcount, colCount - 1)
Cells(rowcount, colCount + 4) = amt

End If
End If
End If

Next rowcount

End Sub

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Enter value in compute cell location? dpb <none@none.net> - 2018-01-16 16:26 -0600
  Re: Enter value in compute cell location? dpb <none@none.net> - 2018-01-18 13:56 -0600
  Re: Enter value in compute cell location? "Jianguo Li" <2@1.com> - 2018-01-17 09:06 +0800
    Re: Enter value in compute cell location? dpb <none@none.net> - 2018-01-22 08:39 -0600
      Re: Enter value in compute cell location? dpb <none@none.net> - 2018-01-22 08:51 -0600
      Re: Enter value in compute cell location? killme2008 <killme2008.14adfdf8@excelbanter.com> - 2018-01-24 08:11 +0000
  Re: Enter value in compute cell location? Gerry Timber <swa2194@gmail.com> - 2018-01-24 03:34 -0800
    Re: Enter value in compute cell location? dpb <none@none.net> - 2018-01-24 09:26 -0600
    Re: Enter value in compute cell location? GS <gs@v.invalid> - 2018-01-24 10:37 -0500
    Re: Enter value in compute cell location? GS <gs@v.invalid> - 2018-01-24 19:09 -0500
      Re: Enter value in compute cell location? GS <gs@v.invalid> - 2018-01-24 19:12 -0500
  Re: Enter value in compute cell location? Gerry Timber <swa2194@gmail.com> - 2018-01-24 12:07 -0800
  Re: Enter value in compute cell location? GS <gs@v.invalid> - 2018-01-24 19:29 -0500

csiph-web