Skip,
Thanks for the input, but taking the basic exmaple where on Sheet1 there is a command button with the code
Sheets("RETU").Range("A7", "L1000").ClearContents
..then I still get the Range error. If I precede the code with Sheets("RETU").Activate then it works.
I can only presume this is...
Hugh,
I created a new workbook with your scenario:
Private Sub CommandButton1_Click()
Sheets(2).Range("A2:D3").ClearContents
End Sub
This does not work on my config (see above post).
Whilst it's overkill, is there another way to inderctly code the ClearContents method without...
Hugh,
Thanks for the help. When I try this I get:
Run-time error '1004'
ClearContents method of Range class failed
(When I put the Sheets("RETU").Activate code before your suggestion it runs OK - but note that I do not need to do this on the other sheets. However focus is still left on RETU...
Hi all,
Hoping you can assist, I'm all out on ideas!
I have a Sub in a module which calls Subs on individual sheets. The Sub in the individual sheets needs to clear a range of cells, but I do not wish the focus to change to any of these sheets from the one the user is viewing. (Note: the Subs...
If the return value is numeric then you cannot assume leading zeros will be displayed. If the number is converted to be displayed as a string then this can be done.
Try:
select right("00000" + convert(varchar(5),@your_number),5)
Please note though that if you try and convert this back to an...
All,
An update to this issue I had. I have amalgamated the posts from PHV, vgersh99 and Ygor.
To recap:
Two files, one a configuration file, and one data:
File Contents:
columns.cfg
HEADER,first,second,third,fourth
data.txt
Cat,Dog,Cow,Sheep
Apple,Banana,Peach,Grape
Blue,Yellow,Red,Green...
PHV,
Sure thing...not working exactly as I require it yet, but the code here should be enough for other codies to work with.
#!/bin/ksh
# NOTE: THIS CODE IS CONDENSED & SENSITIVE INFORMATION REMOVED/RENAMED.
#------------initialise variables----------
set -x
fDATE=`date +%Y%m%d`...
vgersh & PHV,
Yep, Solaris it is (we do have some awk scripts on the box, but nothing strangely as seemingly complicated as this!)
I am still getting minor little errors, but I should be able to take it from here.
Thanks once again for your time and assitance. A star to you both.
Regards,
Brian
vgersh99
Hi! Thanks for your input on this matter. I have tried your suggestion, however, instead of an illegal statement message, it tells me it's bailing out. Here's the output:
>>>>>>>>
+ [ -s /opt/test/conf/glexport.cfg ]
+ awk -F, -v Cols=/opt/test/conf/glexport.cfg
BEGIN...
PHV,
Sorry do NOT want this to be a burden to you! Your help is very much appreciated.
Sadly, I still get
syntax error at line 2 and
illegal statement near line 2.
I've tried the following combos:
BEGIN {getline<"`$Columns`";nf=NF;for(i=0;i<nf;++i) c[i]=$(i+1)}
BEGIN...
PHV,
Done as you have suggested regarding variable name.
Output is now
>>>>>>>
+ awk -F,
BEGIN {getline</opt/test/conf/columns.cfg;nf=NF;for(i=0;i<nf;++i) c[i]=$(i+1)}
{ printf "%s,%d",c[0],NR
for(i=1;i<nf;++i) printf ",%s,%s",c[i],$i...
Ygor,
I tried your code suggestion (and changed the var name to CFG) but now I get:
>>>>
+ awk
BEGIN {
OFS=FS=",";
getline < ENVIRON["CFG"];
split($0,c);
}
{
for(i=1;i<NF;i++){...
PHV,
I've had a try with this and get varying messages. Hope you can still assist with this issue.
I'm using variable substitution for the filename so have:
//// START CODE SNIPPET
COLUMNS=$Root/conf/columns.cfg
if [ -s $COLUMNS ]
then
awk -F, '
BEGIN...
PHV,
Wow! Thanks for the quick reply. It's much appreciated. I shall get my head around what is going on so I can underatand, and then see if it's OK in production.
Hold tight....there could be a star on the way!...
Hi all,
Sorry for what may be a newbie question, but I've read what I can on awk and nawk and can't fathom this out. Any help would be greatly appreciated.
I have two files. "columns.cfg" is a config file and "data.txt" is the data.
columns.cfg (one single line)
A,B,C,D,E,...etc.
data.txt...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.